protect possible infinite loop when an order is issued on the same turn as garrisoning is effectively processed

Reviewed By: O2 JS Simulation, elexis, s0600204, bb
Differential Revision: https://code.wildfiregames.com/D686
This was SVN commit r19900.
This commit is contained in:
mimo
2017-07-10 16:10:50 +00:00
parent 43137fef3f
commit 1196ececed
@@ -4975,7 +4975,13 @@ UnitAI.prototype.AddOrder = function(type, data, queued)
if (queued)
this.PushOrder(type, data);
else
{
// May happen only if an order arrives on the same turn the unit is garrisoned
// in that case, just forget the order as this will lead to a weird state
if (this.IsGarrisoned() && !this.IsTurret() && type != "Ungarrison")
return;
this.ReplaceOrder(type, data);
}
};
/**