Improve unit-attack movement

This cleans up and reimplements the last bits from #4469.

- Units will now update their path if the unit they are following moves (fixes #4455).
- Units will now move to a valid firing position if their target is inside their minimum range (closes #2923).
- Units will attack from their maximum range (when attacking structures) or one cell closer (when attacking mobile units), instead of running up beside them (fixes #2104).

This will need some careful testing, as a) it potentially affects anything that moves, and b) it has been rebased over a lot of changes, so it may no longer properly fix the things I'm claiming it does.

In particular, I'm not sure whether we had a reason for disabling the cell heuristic in the MoveAdjacentTo path-finding. In most cases we *do* want to select the nearest adjacent cell, but I may be forgetting some weird corner case.
If this is a hack, what's the right way to do it?