Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/settings.js
Show All 26 Lines | |||||
* @returns {Object|undefined} | * @returns {Object|undefined} | ||||
*/ | */ | ||||
function loadSettingsValues() | function loadSettingsValues() | ||||
{ | { | ||||
var settings = { | var settings = { | ||||
"AIDescriptions": loadAIDescriptions(), | "AIDescriptions": loadAIDescriptions(), | ||||
"AIDifficulties": loadAIDifficulties(), | "AIDifficulties": loadAIDifficulties(), | ||||
"Ceasefire": loadCeasefire(), | "Ceasefire": loadCeasefire(), | ||||
"WonderDurations": loadWonderDuration(), | "VictoryDurations": loadVictoryDuration(), | ||||
"GameSpeeds": loadSettingValuesFile("game_speeds.json"), | "GameSpeeds": loadSettingValuesFile("game_speeds.json"), | ||||
"MapTypes": loadMapTypes(), | "MapTypes": loadMapTypes(), | ||||
"MapSizes": loadSettingValuesFile("map_sizes.json"), | "MapSizes": loadSettingValuesFile("map_sizes.json"), | ||||
"PlayerDefaults": loadPlayerDefaults(), | "PlayerDefaults": loadPlayerDefaults(), | ||||
"PopulationCapacities": loadPopulationCapacities(), | "PopulationCapacities": loadPopulationCapacities(), | ||||
"StartingResources": loadSettingValuesFile("starting_resources.json"), | "StartingResources": loadSettingValuesFile("starting_resources.json"), | ||||
"VictoryConditions": loadVictoryConditions() | "VictoryConditions": loadVictoryConditions() | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | return [ | ||||
{ | { | ||||
"Name": "very hard", | "Name": "very hard", | ||||
"Title": translateWithContext("aiDiff", "Very Hard") | "Title": translateWithContext("aiDiff", "Very Hard") | ||||
} | } | ||||
]; | ]; | ||||
} | } | ||||
/** | /** | ||||
* Loads available wonder-victory times | * Loads available victory times for victory conditions like Wonder and Capture The Relic. | ||||
*/ | */ | ||||
function loadWonderDuration() | function loadVictoryDuration() | ||||
{ | { | ||||
var jsonFile = "wonder_times.json"; | var jsonFile = "victory_times.json"; | ||||
var json = Engine.ReadJSONFile(g_SettingsDirectory + jsonFile); | var json = Engine.ReadJSONFile(g_SettingsDirectory + jsonFile); | ||||
if (!json || json.Default === undefined || !json.Times || !Array.isArray(json.Times)) | if (!json || json.Default === undefined || !json.Times || !Array.isArray(json.Times)) | ||||
{ | { | ||||
error("Could not load " + jsonFile); | error("Could not load " + jsonFile); | ||||
return undefined; | return undefined; | ||||
} | } | ||||
bb: Screeming for globals here, but those are all over the file, so for another patch. | |||||
return json.Times.map(duration => ({ | return json.Times.map(duration => ({ | ||||
Not Done Inline ActionsThis works? bb: This works? | |||||
Done Inline ActionsNo it doesnt. It's kind of the same string in both cases and it's better to avoid the hardcoded strings altogether. They might be used with more gamemodes too! (Capture The Sheep or Capture Your Mom as suggested on the forums :D) elexis: No it doesnt. It's kind of the same string in both cases and it's better to avoid the hardcoded… | |||||
"Duration": duration, | "Duration": duration, | ||||
"Default": duration == json.Default, | "Default": duration == json.Default, | ||||
"Title": sprintf(translatePluralWithContext("wonder victory", "%(min)s minute", "%(min)s minutes", duration), { "min": duration }) | "Title": sprintf(translatePluralWithContext("victory duration", "%(min)s minute", "%(min)s minutes", duration), { "min": duration }) | ||||
Done Inline ActionsI believe this is not allowed with transifex the ternary should go outside the translate function IIRC bb: I believe this is not allowed with transifex the ternary should go outside the translate… | |||||
Not Done Inline ActionsYes, elexis also mentioned that. Sandarac: Yes, elexis also mentioned that. | |||||
})); | })); | ||||
} | } | ||||
/** | /** | ||||
* Loads available ceasefire settings. | * Loads available ceasefire settings. | ||||
* | * | ||||
* @returns {Array|undefined} | * @returns {Array|undefined} | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Screeming for globals here, but those are all over the file, so for another patch.