HomeWildfire Games

Fix GetPosition2D call when the entity may be out of the world in unitMotion

Description

Fix GetPosition2D call when the entity may be out of the world in unitMotion

As reported by Freagarach following rP23806.

rP22526 introduced a "MoveObstructed" message, that could be sent when the entity ran into obstructions, to stop early.
In HandleObstructedMove, my intention, as written in the comment, was that the caller would do its thing (call StopMoving(), move out of the world etc.) and thus ComputeGoal would return early.

However, I mistakenly left the cmpPosition->GetPosition2D() in between that and ComputeGoal, which would then fail.

This fixes that by moving it after the ComputeGoal call.

Also add a sanity StopMoving() call to rP23806's move-out-of-world call.

Reported by: Freagarach

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