fixes Petra trying to keep going with a canceled attack
This was SVN commit r15092.
This commit is contained in:
parent
15f56cd984
commit
b8e9bae75e
@ -165,11 +165,14 @@ m.AttackManager.prototype.update = function(gameState, queues, events)
|
||||
{
|
||||
// we have a barracks and we want to rush, rush.
|
||||
var attackPlan = new m.AttackPlan(gameState, this.Config, this.totalNumber, "Rush");
|
||||
if (this.Config.debug > 0)
|
||||
warn("Headquarters: Rushing plan " + this.totalNumber + " with maxRushes " + this.maxRushes);
|
||||
this.rushNumber++;
|
||||
this.totalNumber++;
|
||||
this.upcomingAttacks["Rush"].push(attackPlan);
|
||||
if (!attackPlan.failed)
|
||||
{
|
||||
if (this.Config.debug > 0)
|
||||
warn("Headquarters: Rushing plan " + this.totalNumber + " with maxRushes " + this.maxRushes);
|
||||
this.rushNumber++;
|
||||
this.totalNumber++;
|
||||
this.upcomingAttacks["Rush"].push(attackPlan);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if we have a barracks, there's no water, we're at age >= 1 and we've decided to attack.
|
||||
@ -215,11 +218,14 @@ m.AttackManager.prototype.update = function(gameState, queues, events)
|
||||
{
|
||||
// prepare a raid against this target
|
||||
var attackPlan = new m.AttackPlan(gameState, this.Config, this.totalNumber, "Raid", target.owner(), target);
|
||||
if (this.Config.debug > 0)
|
||||
warn("Headquarters: Raiding plan " + this.totalNumber);
|
||||
this.raidNumber++;
|
||||
this.totalNumber++;
|
||||
this.upcomingAttacks["Raid"].push(attackPlan);
|
||||
if (!attackPlan.failed)
|
||||
{
|
||||
if (this.Config.debug > 0)
|
||||
warn("Headquarters: Raiding plan " + this.totalNumber);
|
||||
this.raidNumber++;
|
||||
this.totalNumber++;
|
||||
this.upcomingAttacks["Raid"].push(attackPlan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -358,12 +358,9 @@ m.AttackPlan.prototype.updatePreparation = function(gameState, events)
|
||||
// We still have time left to recruit units and do stuffs.
|
||||
this.trainMoreUnits(gameState);
|
||||
Engine.ProfileStop();
|
||||
// can happen for now ?? really ?? should have been fixed now
|
||||
// may happen if we have no more training facilities and build orders are canceled
|
||||
if (this.buildOrder.length === 0)
|
||||
{
|
||||
warn("Should never happen plan incomplete but no more buildOrder ???");
|
||||
return 0; // will abort the plan, should return something else
|
||||
}
|
||||
return 0; // will abort the plan
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user