1
0
forked from 0ad/0ad

[Petra] Remove global constant from queueplanBuilding.js

If someone would try to copy petra and use it as base of own ai, one
would not be able to run both ais at the same time and had to fix that
global constant anyway.

Differential revision: D4301
Reviewed by: @Freagarach
This was SVN commit r25957.
This commit is contained in:
Angen 2021-10-10 19:02:21 +00:00
parent 0c1297de3a
commit b1a01005b8

View File

@ -739,7 +739,7 @@ PETRA.ConstructionPlan.prototype.checkDockPlacement = function(gameState, x, z,
* if the (object) wantedLand is given, this nearest land should have one of these accessibility
* if wantedSea is given, this tile should be inside this sea
*/
const around = [[ 1.0, 0.0], [ 0.87, 0.50], [ 0.50, 0.87], [ 0.0, 1.0], [-0.50, 0.87], [-0.87, 0.50],
PETRA.ConstructionPlan.prototype.around = [[ 1.0, 0.0], [ 0.87, 0.50], [ 0.50, 0.87], [ 0.0, 1.0], [-0.50, 0.87], [-0.87, 0.50],
[-1.0, 0.0], [-0.87, -0.50], [-0.50, -0.87], [ 0.0, -1.0], [ 0.50, -0.87], [ 0.87, -0.50]];
PETRA.ConstructionPlan.prototype.isDockLocation = function(gameState, j, dimension, wantedLand, wantedSea)
@ -759,7 +759,7 @@ PETRA.ConstructionPlan.prototype.isDockLocation = function(gameState, j, dimensi
landPass < 2 && accessibility.navalPassMap[k] < 2)
return false;
for (let a of around)
for (let a of this.around)
{
pos = accessibility.gamePosToMapPos([x + dimLand*a[0], z + dimLand*a[1]]);
if (pos[0] < 0 || pos[0] >= accessibility.width)
@ -803,7 +803,7 @@ PETRA.ConstructionPlan.prototype.getFrontierProximity = function(gameState, j)
let ix = j % width;
let iz = Math.floor(j / width);
let best = 5;
for (let a of around)
for (let a of this.around)
{
for (let i = 1; i < 5; ++i)
{