HomeWildfire Games

Fix infinite loop in healing & potential one elsewhere.

Description

Fix infinite loop in healing & potential one elsewhere.

HEAL can infinite loop: if the HEAL.APPROACHING:MoveTo call fails, the unit will fallback to FINDINGNEWTARGET, which looks for new targets to heal, which can loop around.
In #6106, the cause was that the target was not visible despite the order being given (presumably a rangemanager/los incompatibility issue).
When MoveTo() fail, orders usually call FinishOrder as that's irrecoverable.

Further, GATHERING/COLLECTINGTREASURE also did not FinishOrder - there, we do want to consider new resources if the target is e.g. unreachable, so add an explicit check for AbleToMove.

Reported by: moiman

Reviewed By: Freagarach

Fixes #6106

Differential Revision: https://code.wildfiregames.com/D3689

Details