As introduced in rP22566, units now reject paths that would take them farther from the goal than their current position.
This does a few things:
- use the "pretend correct path" for short goals too. This is a better fix for #5545, since the position check now works correctly without needing to add a tricky check for path-vs-path distance.
- simplify HandleObstructedMove to use ComputePathToGoal more. This means we occasionally compute a long path when stuck, which avoids the "horrible" bug in #5547 which I thought I didn't have a fix for. It's also slightly less hacky.
- Move some common calls into functions for convenience.
- make sure the short-path-waypoint-range-relaxing introduced in rP22526 doesn't happen for the last waypoint or things went awry easily.
This won't fix all instances of unit dancing, but it should improve most of them.