Differential D4811 Diff 20999 ps/trunk/binaries/data/mods/public/gamesettings/attributes/PlayerColor.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gamesettings/attributes/PlayerColor.js
Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | _getMapData(i) | ||||
if (data.settings.PlayerData.length <= i) | if (data.settings.PlayerData.length <= i) | ||||
return undefined; | return undefined; | ||||
return data.settings.PlayerData[i].Color; | return data.settings.PlayerData[i].Color; | ||||
} | } | ||||
_updateAvailable() | _updateAvailable() | ||||
{ | { | ||||
// Pick colors that the map specifies, add most unsimilar default colors | // Pick colors that the map specifies, add most unsimilar default colors | ||||
// Provide the access to g_MaxPlayers different colors, regardless of current playercount. | // Provide the access to all the colors defined in simulation/data/settings/player_defaults.json, | ||||
// regardless of current playercount. | |||||
let values = []; | let values = []; | ||||
let mapColors = false; | let mapColors = false; | ||||
for (let i = 0; i < g_MaxPlayers; ++i) | for (let i = 0; i < this.defaultColors.length; ++i) | ||||
{ | { | ||||
let col = this._getMapData(i); | let col = this._getMapData(i); | ||||
if (col) | if (col) | ||||
mapColors = true; | mapColors = true; | ||||
if (mapColors) | if (mapColors) | ||||
values.push(col || this._findFarthestUnusedColor(values)); | values.push(col || this._findFarthestUnusedColor(values)); | ||||
else | else | ||||
values.push(this.defaultColors[i]); | values.push(this.defaultColors[i]); | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator