D981/rP22345 changed IsInXChecks to use edge-to-edge distance instead of centre-to-edge, which broke UnitMotion's min-range movement (we need a certain buffer-zone to be safe). Furthermore, it missed introducing support for an infinite max range (when equal to -1), which broken unitAIassumed distance to the center.
This fixes both issuesSince units are treated square, the diagonal point may be closer to the target than the "real" clearance by a factor √2, so the delta between minimum range and maximum range should be at least `(√2 - 1) * clearance` to be safe in all situations (this is generally not a problem for regular units which have a clearance of 0.8, but could be one for catapults or elephants). Note that this doesn't actually apply if the min-range is 0.
Following this revisionNB: since the long-range pathfinder brings units to navcell centres, it can in some cases to actually bring the unit in correct range.
This is alleviated by TryGoingStraightToEntity, but moving with point targets might still fail.
This issue explains why whales will sometimes get stuck during roaming, and also why some units may fail to stop from "Moving" state.
However, D1982 makes TryGoingStraightToEntity work with point targets, and D1983 will improve logic to use the short-range pathfinder when we get close to the target and are out of waypoint, we can probably reduce minwhich should fix this issue - until the long-ranges of a number of thingse pathfinder's MakeGoalReachable is improved in that respect.