forked from 0ad/0ad
petra: fix a misbehaviour spotted by sanderd17, when the defenseManager tries to rescue units performing an attack
This was SVN commit r17953.
This commit is contained in:
parent
c5ede78373
commit
b0c74fdaa0
@ -399,6 +399,15 @@ m.DefenseManager.prototype.checkEvents = function(gameState, events)
|
||||
if (target.hasClass("Ship")) // TODO integrate ships later need to be sure it is accessible
|
||||
continue;
|
||||
|
||||
// If inside a started attack plan, let the plan deal with this unit
|
||||
let plan = target.getMetadata(PlayerID, "plan");
|
||||
if (plan !== undefined && plan >= 0)
|
||||
{
|
||||
let attack = gameState.ai.HQ.attackManager.getPlan(plan);
|
||||
if (attack && attack.state !== "unexecuted")
|
||||
continue;
|
||||
}
|
||||
|
||||
// Signal this attacker to our defense manager, except if we are in enemy territory
|
||||
// TODO treat ship attack
|
||||
if (attacker && attacker.position() && attacker.getMetadata(PlayerID, "PartOfArmy") === undefined &&
|
||||
@ -409,15 +418,6 @@ m.DefenseManager.prototype.checkEvents = function(gameState, events)
|
||||
this.makeIntoArmy(gameState, attacker.id());
|
||||
}
|
||||
|
||||
// If inside a started attack plan, let the plan deal with this unit
|
||||
let plan = target.getMetadata(PlayerID, "plan");
|
||||
if (plan !== undefined && plan >= 0)
|
||||
{
|
||||
let attack = gameState.ai.HQ.attackManager.getPlan(plan);
|
||||
if (attack && attack.state !== "unexecuted")
|
||||
continue;
|
||||
}
|
||||
|
||||
if (target.getMetadata(PlayerID, "PartOfArmy") !== undefined)
|
||||
{
|
||||
let army = this.getArmy(target.getMetadata(PlayerID, "PartOfArmy"));
|
||||
|
Loading…
Reference in New Issue
Block a user