forked from mirrors/0ad
@@ -101,7 +101,7 @@ function distanceToPlayers(x, z)
|
||||
var dz = z - playerZ[i];
|
||||
r = Math.min(r, Math.square(dx) + Math.square(dz));
|
||||
}
|
||||
return sqrt(r);
|
||||
return Math.sqrt(r);
|
||||
}
|
||||
|
||||
function playerNearness(x, z)
|
||||
|
||||
@@ -210,7 +210,7 @@ for (let g = 0; g < scaleByMapSize(5, 30); ++g)
|
||||
var p2 = 0;
|
||||
|
||||
for (let i = 0; i < numPlayers; ++i)
|
||||
distances.push(sqrt((tx-mapSize*playerX[i])*(tx-mapSize*playerX[i])+(tz-mapSize*playerZ[i])*(tz-mapSize*playerZ[i])));
|
||||
distances.push(Math.euclidDistance2D(tx, tz, fractionToTiles(playerX[i]), fractionToTiles(playerZ[i])));
|
||||
|
||||
for (let a = 0; a < numPlayers; ++a)
|
||||
{
|
||||
|
||||
@@ -72,11 +72,6 @@ function round(x)
|
||||
return Math.round(x);
|
||||
}
|
||||
|
||||
function sqrt(x)
|
||||
{
|
||||
return Math.sqrt(x);
|
||||
}
|
||||
|
||||
function floor(x)
|
||||
{
|
||||
return Math.floor(x);
|
||||
|
||||
@@ -36,7 +36,7 @@ ClumpPlacer.prototype.place = function(constraint)
|
||||
|
||||
var size = getMapSize();
|
||||
var gotRet = new Array(size).fill(0).map(p => new Uint8Array(size)); // booleans
|
||||
var radius = sqrt(this.size / PI);
|
||||
var radius = Math.sqrt(this.size / Math.PI);
|
||||
var perim = 4 * radius * 2 * PI;
|
||||
var intPerim = Math.ceil(perim);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user