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.

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)
  • Loading branch information
oxxide authored and ashenomo committed May 1, 2019
1 parent b8686e3 commit efe5057
Show file tree
Hide file tree
Showing 2 changed files with 263 additions and 208 deletions.

0 comments on commit efe5057

Please sign in to comment.