Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make goto numerically stable on 32 bit targets
float
on 32 bit platforms has some quirksCTask::IsEnded()
should not be modifying instance variables because we rely onCTask::IsEnded()
to not change its return value if called twice in a row. This is a small step in that direction - fixing one cause where modifying an instance variable caused a different value to be returned on a subsequent call.Test case
Completed mission 4-3 (System Failure) on a 32 bit platform with CMAKE_BUILD_TYPE=RelWithDebInfo
Fix goto orbiting
goto(position, altitude, 1, 1)
used to instruct the bot to apply full forward thrust even if it is facing more than 90 degrees away from the destination. This resulted in the bots sometimes endlessly orbiting the destination.Fix: apply the same forward speed reduction that several other parts of CTaskGoto use.
Test case 1
Test case 2
Add a cheat to simulate low frames per second
fps <number>
to enable testing how the game handles low frames per secondfps 10
caps the frames per second at 10fps 0
uncaps the fpsRestore 5 meter margin for flying bots
When fps is low a bot may overshoot the destination and double back. This no longer gets the bot stuck in an infinite loop because I fixed the orbiting, but this makes the bot in the mission 4-3 (System Failure) run out of battery before completing the program if the game is running at 4 frames per second.
Fix: re-introduce the 5 meter margin for flying bots
Test case
Completed mission 4-3 (System Failure) with 4 fps