OpenRA
OpenRA copied to clipboard
Fly, use rotating buffer over list to store last 5 positions.
Fly stores the last the position over the lats 5 ticks to determine the distance travelled and whether flight is stuck.
- Replace position buffer
List
with an rotating buffer. To avoid removing the head element from a list array each tick. Avoiding a ArrayCopy/Move each tick. - Avoid addition of one WVec/Pos to Zero WVev/Pos. Trivial.
- Tickfacing, 50% change of one less subtraction. Trivial.
-
RotatingBuffer
can be reused in new contrail implementation. Could potentially also be used in input tap detection. (only used function tested)
Future possible improvements: Map.DistanceAboveTerrain
is looked up more often by all flight activites/functions - during the same tick. For rectangular maps the operation is not that expensive. Functions already take many arguments - did not want to add it.