Skip to content

Commit

Permalink
If a vehicle ends up with a GotoLocation mission to an unreachable ti…
Browse files Browse the repository at this point in the history
…le, it will repeatedly try to find a path in every game tick. The vehicle will eventually get stuck and slow down the game by spamming pathfinding requests. (#563)

Note that vehicles usually don't end up with a GotoLocation with an unreachable destination, but it's possible, i.e. if some road tiles on the way get destroyed after the mission is created.

Other fixes:
* Prevent a vehicle from side-stepping in order to avoid itself.

Implementation notes:
* Moved all adjustTarget* methods to a new class VehicleTargetHelper with a single method that dispatches based on vehicle type.
* Note that it's now that caller's responsibility to set pickedNearest as needed.
* Inverted some conditionals for clearer early returns.

Manually verified these vehicles are un-stuck after this change:
* #395 (comment)
* #395 (comment)

Run clang-format

Run clang-format 4.0.0, which is the version used by Travis CI.
  • Loading branch information
ashenomo committed May 12, 2019
1 parent 7bc3f05 commit d916a85
Show file tree
Hide file tree
Showing 2 changed files with 247 additions and 192 deletions.

0 comments on commit d916a85

Please sign in to comment.