1
0
forked from 0ad/0ad

Fix issues with formation + packing.

- e7e218a3bc contained a small mistake: this.order wasn't cleared when
clearing the orderqueue, which led to a broken codepath in
PushOrderFront.
- Since 71a61d5f50, formation orders their members to reform in IDLE.
This will automatically pack any unpacked siege.

Reported by: langbart
Tested by: langbart
Fixes #6018

Differential Revision: https://code.wildfiregames.com/D3561
This was SVN commit r24895.
This commit is contained in:
wraitii 2021-02-13 10:08:10 +00:00
parent 18bc3e47ea
commit 674cdae166

View File

@ -231,6 +231,14 @@ UnitAI.prototype.UnitFsmSpec = {
if (this.CanPack())
{
// If the controller is IDLE, this is just the regular reformation timer.
// In that case we don't actually want to move, as that would unpack us.
let cmpControllerAI = Engine.QueryInterface(this.GetFormationController(), IID_UnitAI);
if (cmpControllerAI.IsIdle())
{
this.FinishOrder();
return;
}
this.PushOrderFront("Pack", { "force": true });
return;
}
@ -4172,7 +4180,10 @@ UnitAI.prototype.ReplaceOrder = function(type, data)
// (this is needed to support queued no-formation orders).
let idx = this.orderQueue.findIndex(o => o.type == "LeaveFormation");
if (idx === -1)
{
this.orderQueue = [];
this.order = undefined;
}
else
this.orderQueue.splice(0, idx);
this.PushOrderFront(type, data);