HomeWildfire Games

Fix UnitAI infinite loop following rP22023

Description

Fix UnitAI infinite loop following rP22023

As reported by Angen and Gurken Khan on the forums, there is a crash following rP22023 caused by an infinite loop in UnitAI. The reason is that IDLE.enter can order us to attack, which can fail, switching us right away back to idle.

FinishOrder's behaviour allows us to have IDLE as a default state and lets us not lose a turn when becoming idle, so to keep this behaviour explicitely check that we are not already in IDLE before switching states.

Reported by: Angen, Gurken Khan
Commented by: elexis, Itms

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