AI: remove code from old pathFinder

This was SVN commit r16789.
This commit is contained in:
mimo 2015-06-17 21:03:49 +00:00
parent 989f164500
commit 008fb80855
4 changed files with 6 additions and 21 deletions

View File

@ -31,10 +31,7 @@ m.aStarPath = function(gameState, onWater, disregardEntities, targetTerritory)
var passMap = gameState.sharedScript.passabilityMap;
var terrMap = gameState.sharedScript.territoryMap;
var ratio = terrMap.cellSize / passMap.cellSize;
if (passMap.cellSize == 4)
var pathObstruction = gameState.sharedScript.passabilityClasses["pathfinderObstruction"];
else // new pathFinder branch
var pathObstruction = gameState.sharedScript.passabilityClasses["default"];
var pathObstruction = gameState.sharedScript.passabilityClasses["default"];
this.widthMap = new Uint8Array(this.map.length);
for (var i = 0; i < this.map.length; ++i)

View File

@ -27,21 +27,12 @@ m.TerrainAnalysis.prototype.init = function(sharedScript,rawState)
this.width = passabilityMap.width;
this.height = passabilityMap.height;
this.cellSize = passabilityMap.cellSize;
// the first two won't change, the third is a reference to a value updated by C++
if (this.cellSize == 4)
{
var obstructionMaskLand = rawState.passabilityClasses["default"];
var obstructionMaskWater = rawState.passabilityClasses["ship"];
}
else // new pathFinder branch
{
var obstructionMaskLand = rawState.passabilityClasses["default-terrain-only"];
var obstructionMaskWater = rawState.passabilityClasses["ship-small"];
}
var obstructionMaskLand = rawState.passabilityClasses["default-terrain-only"];
var obstructionMaskWater = rawState.passabilityClasses["ship-small"];
var obstructionTiles = new Uint8Array(passabilityMap.data.length);
/* Generated map legend:
0 is impassable
200 is deep water (ie non-passable by land units)

View File

@ -38,9 +38,6 @@ m.createObstructionMap = function(gameState, accessIndex, template)
var obstructionMask = gameState.getPassabilityClassMask("building-land");
}
if (passabilityMap.cellSize == 4) // old pathFinder
var obstructionMask = obstructionMask | gameState.getPassabilityClassMask("foundationObstruction");
for (var k = 0; k < territoryMap.data.length; ++k)
{
let tilePlayer = (territoryMap.data[k] & m.TERRITORY_PLAYER_MASK);

View File

@ -314,7 +314,7 @@ m.ConstructionPlan.prototype.findGoodPosition = function(gameState)
else if (template.resourceDropsiteTypes() === undefined && !template.hasClass("House") && !template.hasClass("Field"))
radius = Math.ceil((template.obstructionRadius() + 4) / obstructions.cellSize);
else
radius = Math.ceil(template.obstructionRadius() / obstructions.cellSize);
radius = Math.ceil(template.obstructionRadius() / obstructions.cellSize) + 1;
if (template.hasClass("House") && !alreadyHasHouses)
{