Page MenuHomeWildfire Games

Unit Motion - wrap target state into a struct
ClosedPublic

Authored by wraitii on May 13 2019, 9:46 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22352: Unit Motion - wrap target state into a struct
Summary

These variables together held the state for the target of UnitMotion, as set by the MoveTo[X] family of functions.
Wrapping them in a struct reduces the chances that one will accidentally forget to reset part of the state and makes it explicit in-code that these are grouped together.

We also reset these when calling StopMoving(), which was missed before (and which left us in a half-broken state). D1886 makes this fine since unitMotion is no longer stopping on its own.

Test Plan

Compile.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

wraitii created this revision.May 13 2019, 9:46 PM

Successful build - Chance fights ever on the side of the prudent.

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

Stan added a subscriber: Stan.May 16 2019, 12:08 PM
Stan added inline comments.
source/simulation2/components/CCmpUnitMotion.cpp
230 ↗(On Diff #8015)
wraitii updated this revision to Diff 8071.May 19 2019, 4:44 PM

Updated (maybe, I've lost track of what I've changed)

wraitii added inline comments.May 19 2019, 5:09 PM
source/simulation2/components/CCmpUnitMotion.cpp
230 ↗(On Diff #8015)

It's POD-like and doesn't really do anything too clever. The serialisation could/should be moved to the component, and the GetOffset is just readability sugar.

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

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

wraitii updated this revision to Diff 8122.May 25 2019, 4:30 PM

Rebased

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

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

wraitii updated this revision to Diff 8385.Jun 8 2019, 2:57 PM

Rebased for committing.

Vulcan added a comment.Jun 8 2019, 3:40 PM

Successful build - Chance fights ever on the side of the prudent.

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

This revision was not accepted when it landed; it landed in state Needs Review.Jun 9 2019, 1:18 PM
This revision was automatically updated to reflect the committed changes.