HomeWildfire Games

Fix 'gliding' behaviour at the end of movement by moving the…

Description

Fix 'gliding' behaviour at the end of movement by moving the PossiblyAtDestination check earlier.

Units in 0 A.D. exhibited a "gliding" behaviour at the end of a movement, e.g. they switched to the Idle animation and still moved a little bit.

The reason for this behaviour is that entities check if they reached their destination after moving. Other components (unitAI mostly) will then possibly change animations and such, resulting in a movement over the turn while the entity is possibly now in another animation state than "move".
Instead, what should be done is checking if the entity has arrived before moving, so if UnitAI calls StopMoving, then entity won't move at all on the same turn, and the gliding effect vanishes.

The STATE_STOPPING state is made un-necessary by this change, since this off-by-one mistake was the reason for its existence. It can be removed (see downstream).

Differential Revision: https://code.wildfiregames.com/D1898