1
0
forked from 0ad/0ad

Remove getTeamsArray copy from Island Stronghold (875a774da9) following the introduction of rmgen2 in 6d52a71d4a (d8ed6d828a).

(Don't replace the starting base code of that map to a call to
placeStronghold because the code in this variant is the only one that
doesn't have resource collisions on tiny maps currently, refs #3851.)

This was SVN commit r20516.
This commit is contained in:
elexis 2017-11-25 00:24:44 +00:00
parent bbe1ddc5cf
commit 993869ffb8

View File

@ -12,6 +12,7 @@ function getPlayerTileCoordinates(playerIdx, teamIdx, fractionX, fractionZ)
}
RMS.LoadLibrary("rmgen");
RMS.LoadLibrary("rmgen2");
RMS.LoadLibrary("rmbiome");
RMS.LoadLibrary("heightmap");
@ -80,36 +81,7 @@ initTerrain(tWater);
var startAngle = randFloat(0, 2 * Math.PI);
// Group players by team
var teams = [];
for (let i = 0; i < numPlayers; ++i)
{
let team = getPlayerTeam(i);
if (team == -1)
continue;
if (!teams[team])
teams[team] = [];
teams[team].push(i+1);
}
// Players without a team get a custom index
for (let i = 0; i < numPlayers; ++i)
{
let team = getPlayerTeam(i);
if (team != -1)
continue;
let unusedIndex = teams.findIndex(team => !team);
if (unusedIndex != -1)
teams[unusedIndex] = [i+1];
else
teams.push([i+1]);
}
// Get number of used team IDs
var teams = getTeamsArray();
var numTeams = teams.filter(team => team).length;
var teamNo = 0;