units are not stuck on construction sites anymore. fixes #779
This was SVN commit r9525.
This commit is contained in:
parent
6539456746
commit
d5d5fd3b7d
@ -140,7 +140,7 @@ var UnitFsmSpec = {
|
||||
|
||||
"Order.LeaveFoundation": function(msg) {
|
||||
// Default behaviour is to ignore the order since we're busy
|
||||
this.FinishOrder();
|
||||
this.DiscardOrder();
|
||||
},
|
||||
|
||||
// Individual orders:
|
||||
@ -1378,6 +1378,23 @@ UnitAI.prototype.FinishOrder = function()
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call when you want to drop an order inside a FSM order handler.
|
||||
* Don't change the FSM state.
|
||||
*/
|
||||
UnitAI.prototype.DiscardOrder = function()
|
||||
{
|
||||
if (!this.orderQueue.length)
|
||||
error("DiscardOrder called when order queue is empty");
|
||||
|
||||
this.orderQueue.shift();
|
||||
this.order = this.orderQueue[0];
|
||||
if (!this.orderQueue.length)
|
||||
{
|
||||
this.SetNextState("IDLE");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Add an order onto the back of the queue,
|
||||
* and execute it if we didn't already have an order.
|
||||
|
Loading…
Reference in New Issue
Block a user