1
0
forked from 0ad/0ad

Fix no-formation orders after several formation orders.

When giving several queued formation-walk orders, then a queued
non-formation order (such as gathering), the gather order would be
silently dropped. This did not happen if only one formation-walk order
was given, which is why this issue was not noticed in 59d0885d68

To fix it, explicitly only drop pre-"leave formation" orders in the
queue for formation members.

Reported By: faction02
Differential Revision: https://code.wildfiregames.com/D3550
This was SVN commit r24869.
This commit is contained in:
wraitii 2021-02-10 19:23:39 +00:00
parent 11fde58751
commit e7e218a3bc

View File

@ -4166,6 +4166,17 @@ UnitAI.prototype.ReplaceOrder = function(type, data)
else
this.orderQueue = [packingOrder, order];
}
else if (this.IsFormationMember())
{
// Don't replace orders after a LeaveFormation order
// (this is needed to support queued no-formation orders).
let idx = this.orderQueue.findIndex(o => o.type == "LeaveFormation");
if (idx === -1)
this.orderQueue = [];
else
this.orderQueue.splice(0, idx);
this.PushOrderFront(type, data);
}
else
{
this.orderQueue = [];