forked from 0ad/0ad
Check the length of the unit collection in started attack plans to avoid errors. Fixes #1620
This was SVN commit r12531.
This commit is contained in:
parent
576761c05e
commit
2bdb8f75ff
@ -513,6 +513,10 @@ CityAttack.prototype.update = function(gameState, militaryManager, events){
|
||||
var bool_attacked = false;
|
||||
// raids don't care about attacks much
|
||||
|
||||
// we're over, abort immediately.
|
||||
if (this.unitCollection.length === 0)
|
||||
return 0;
|
||||
|
||||
this.position = this.unitCollection.getCentrePosition();
|
||||
|
||||
var IDs = this.unitCollection.toIdArray();
|
||||
|
@ -570,7 +570,7 @@ aStarPath.prototype.continuePath = function(gamestate)
|
||||
this.gCostArray[index] = this.gCostArray[this.currentSquare] + cost[i] * Sampling;// - this.map[index];
|
||||
|
||||
if (!this.onWater && this.passabilityMap.map[index] === 200) {
|
||||
this.gCostArray[index] += this.width*this.width*2;
|
||||
this.gCostArray[index] += this.width*this.width*3;
|
||||
} else if (this.onWater && this.passabilityMap.map[index] !== 200) {
|
||||
this.gCostArray[index] += this.fCostArray[index];
|
||||
} else if (!this.onWater && this.passabilityMap.map[index] === 100) {
|
||||
@ -594,7 +594,7 @@ aStarPath.prototype.continuePath = function(gamestate)
|
||||
} else {
|
||||
var addCost = 0;
|
||||
if (!this.onWater && this.passabilityMap.map[index] === 200) {
|
||||
addCost = this.width*this.width*2;
|
||||
addCost = this.width*this.width*3;
|
||||
} else if (this.onWater && this.passabilityMap.map[index] !== 200) {
|
||||
addCost = this.fCostArray[index];
|
||||
} else if (!this.onWater && this.passabilityMap.map[index] === 100) {
|
||||
|
Loading…
Reference in New Issue
Block a user