As introduced in rP22566, units now reject paths that would take them farther from the goal than their current position.
HoweverThis 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, as reportedwhich avoids the "horrible" bug in #5545,7 which I thought I didn't have a fix for. we should also reject paths if we have a path right now and our current path takes us closer to the goal than this new pathIt'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.
ProbablyThis won't fix all instances of infiniteunit dancing, but it should be pretty rare nowimprove most of them.