Page MenuHomeWildfire Games

UnitMotion - Split Move() into several functions
ClosedPublic

Authored by wraitii on May 15 2019, 10:44 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22364: UnitMotion - Split Move() into several functions
Summary

Move() is generally 4 parts:

  • Moving
  • Updating our state
  • Handling obstructed moves
  • Checking if we are at destination.

These can all be put in their own functions, clarifying logic and making it harder to make mistakes. D1893 and D1896 make it trivial.

Test Plan

Compile.

Diff Detail

Event Timeline

wraitii created this revision.May 15 2019, 10:44 PM

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

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

wraitii updated this revision to Diff 8076.May 19 2019, 4:50 PM

Updated

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

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

wraitii updated this revision to Diff 8124.Sat, May 25, 4:33 PM

Rebased

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

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

Angen added a subscriber: Angen.Sun, Jun 9, 7:10 PM
Angen added inline comments.
source/simulation2/components/CCmpUnitMotion.cpp
853

please add space after pos.X,

956

maybe use negation to return true as early return and you do not need if {} else {}

982

negation for early return and remove if else ?

1007

It does not looks like obstruction required handling here, we just stopped as we are close no?

wraitii updated this revision to Diff 8427.Mon, Jun 10, 9:39 PM

Rebased for committing (tomorrow maybe)

wraitii added inline comments.Mon, Jun 10, 9:41 PM
source/simulation2/components/CCmpUnitMotion.cpp
1007

ClosEnoughFromDestinationToStop is more liberal than the range checks.

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

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

This revision was not accepted when it landed; it landed in state Needs Review.Tue, Jun 11, 7:27 PM
This revision was automatically updated to reflect the committed changes.