1
1
forked from 0ad/0ad

petra: fixes some unit assignments

This was SVN commit r21214.
This commit is contained in:
mimo 2018-02-14 18:58:51 +00:00
parent 8f4db16139
commit 98791a86a1
2 changed files with 6 additions and 4 deletions

View File

@ -640,7 +640,7 @@ m.AttackPlan.prototype.assignUnits = function(gameState)
return added;
}
if (this.type === "Raid")
if (this.type == "Raid")
{
// Raid are fast cavalry attack: assign all cav except some for hunting
let num = 0;
@ -699,10 +699,10 @@ m.AttackPlan.prototype.assignUnits = function(gameState)
m.dumpEntity(ent);
continue;
}
if (this.type !== "Rush" && ent.getMetadata(PlayerID, "subrole") !== "idle")
continue;
if (num++ < keep || numbase[baseID] < 5)
continue;
if (this.type != "Rush" && ent.getMetadata(PlayerID, "subrole") != "idle")
continue;
ent.setMetadata(PlayerID, "plan", plan);
this.unitCollection.updateEnt(ent);
added = true;

View File

@ -184,7 +184,9 @@ m.TransportPlan.prototype.removeUnit = function(gameState, unit)
{
let shipId = unit.getMetadata(PlayerID, "onBoard");
if (shipId == "onBoard")
return; // too late, already onBoard
return; // too late, already onBoard
else if (shipId !== undefined)
unit.stopMoving(); // cancel the garrison order
unit.setMetadata(PlayerID, "transport", undefined);
unit.setMetadata(PlayerID, "endPos", undefined);
this.units.updateEnt(unit);