1
0
forked from mirrors/0ad

Remove rmgen sqrt proxy, refs #4933.

This was SVN commit r20793.
This commit is contained in:
elexis
2018-01-07 18:42:22 +00:00
parent ab1bfb83f7
commit 0aa875b3f2
4 changed files with 3 additions and 8 deletions
@@ -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);