Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/common/settings.js
Show First 20 Lines • Show All 365 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Returns title or placeholder "Default". | * Returns title or placeholder "Default". | ||||
* | * | ||||
* @param {Number} mapSize - tilecount | * @param {Number} mapSize - tilecount | ||||
* @returns {string} | * @returns {string} | ||||
*/ | */ | ||||
function translateMapSize(tiles) | function translateMapSize(tiles) | ||||
{ | { | ||||
let mapSize = g_Settings.MapSizes.find(mapSize => mapSize.Tiles == +tiles); | let mapSize = g_Settings.MapSizes.find(size => size.Tiles == +tiles); | ||||
return mapSize ? mapSize.Name : translateWithContext("map size", "Default"); | return mapSize ? mapSize.Name : translateWithContext("map size", "Default"); | ||||
} | } | ||||
/** | /** | ||||
* Returns title or placeholder. | * Returns title or placeholder. | ||||
* | * | ||||
* @param {Number} population - for example 300 | * @param {Number} population - for example 300 | ||||
* @returns {string} | * @returns {string} | ||||
*/ | */ | ||||
function translatePopulationCapacity(population) | function translatePopulationCapacity(population) | ||||
{ | { | ||||
let popCap = g_Settings.PopulationCapacities.find(p => p.Population == population); | let popCap = g_Settings.PopulationCapacities.find(p => p.Population == population); | ||||
return popCap ? popCap.Title : translateWithContext("population capacity", "Unknown"); | return popCap ? popCap.Title : translateWithContext("population capacity", "Unknown"); | ||||
} | } | ||||
/** | /** | ||||
* Returns title or placeholder. | * Returns title or placeholder. | ||||
* | * | ||||
* @param {string} gameType - for example "conquest" | * @param {string} gameType - for example "conquest" | ||||
* @returns {string} | * @returns {string} | ||||
*/ | */ | ||||
function translateVictoryCondition(gameType) | function translateVictoryCondition(gameType) | ||||
{ | { | ||||
let vc = g_Settings.VictoryConditions.find(vc => vc.Name == gameType); | let victoryCondition = g_Settings.VictoryConditions.find(vc => vc.Name == gameType); | ||||
return vc ? vc.Title : translateWithContext("victory condition", "Unknown"); | return victoryCondition ? victoryCondition.Title : translateWithContext("victory condition", "Unknown"); | ||||
} | } |
Wildfire Games · Phabricator