Page MenuHomeWildfire Games

UnitMotion - move "possibly at destination" checks earlier in Move()
Needs ReviewPublic

Authored by wraitii on Wed, May 15, 10:49 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

Units in 0 A.D. currently exhibit a "gliding" behaviour at the end of a movement: they switch to the Idle animation and still move a little bit.

This is because of poor handling of state and one risky behaviour: checking if we are at destination after movement has taken place. Effectively, UnitMotion says it's arrived on the same turn as it moved, which breaks expectations in other components.
Instead, what should be done is checking if we've arrived before moving, so if UnitAI calls StopMoving, we 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).

Because of D1897, this is a simple change.

Test Plan

Compile, acknowledge that the gliding behaviour is fixed.

Diff Detail

Event Timeline

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/differential/1416/display/redirect

wraitii updated this revision to Diff 8077.Sun, May 19, 4:51 PM

Updated

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/differential/1453/display/redirect