From d045bb87d6f545a2801c5684fa2fd8da63c0a1aa Mon Sep 17 00:00:00 2001 From: mimo Date: Mon, 22 Jun 2015 16:49:49 +0000 Subject: [PATCH] fix the market placement following new pathFinder changes This was SVN commit r16808. --- .../data/mods/public/simulation/ai/petra/headquarters.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/binaries/data/mods/public/simulation/ai/petra/headquarters.js b/binaries/data/mods/public/simulation/ai/petra/headquarters.js index 2016ace09d..e00593ccbb 100644 --- a/binaries/data/mods/public/simulation/ai/petra/headquarters.js +++ b/binaries/data/mods/public/simulation/ai/petra/headquarters.js @@ -981,8 +981,9 @@ m.HQ.prototype.findMarketLocation = function(gameState, template) else if (template.get("Footprint/Circle")) halfSize = +template.get("Footprint/Circle/@radius"); - var bestIdx = undefined; - var bestVal = undefined; + var bestIdx; + var bestJdx; + var bestVal; var radius = Math.ceil(template.obstructionRadius() / obstructions.cellSize); var isNavalMarket = template.hasClass("NavalMarket"); @@ -1027,6 +1028,7 @@ m.HQ.prototype.findMarketLocation = function(gameState, template) continue; bestVal = maxDist; bestIdx = i; + bestJdx = j; } if (this.Config.debug > 1) @@ -1045,7 +1047,7 @@ m.HQ.prototype.findMarketLocation = function(gameState, template) var x = (bestIdx % obstructions.width + 0.5) * obstructions.cellSize; var z = (Math.floor(bestIdx / obstructions.width) + 0.5) * obstructions.cellSize; - return [x, z, this.basesMap.map[bestIdx], expectedGain]; + return [x, z, this.basesMap.map[bestJdx], expectedGain]; }; // Returns the best position to build defensive buildings (fortress and towers)