Index: binaries/data/mods/public/gui/gamesetup/gamesetup.js
===================================================================
--- binaries/data/mods/public/gui/gamesetup/gamesetup.js (http://svn.wildfiregames.com/public/ps/trunk) (revision 16614)
+++ binaries/data/mods/public/gui/gamesetup/gamesetup.js (working copy)
@@ -12,10 +12,14 @@
const POPULATION_CAP_DEFAULTIDX = 5;
// Translation: Amount of starting resources.
const STARTING_RESOURCES = [translateWithContext("startingResources", "Very Low"), translateWithContext("startingResources", "Low"), translateWithContext("startingResources", "Medium"), translateWithContext("startingResources", "High"), translateWithContext("startingResources", "Very High"), translateWithContext("startingResources", "Deathmatch")];
const STARTING_RESOURCES_DATA = [100, 300, 500, 1000, 3000, 50000];
const STARTING_RESOURCES_DEFAULTIDX = 1;
+// Translation: Ceasefire.
+const CEASEFIRE = [translateWithContext("ceasefire", "No ceasefire"), translateWithContext("ceasefire", "15 seconds"), translateWithContext("ceasefire", "5 minutes"), translateWithContext("ceasefire", "10 minutes"), translateWithContext("ceasefire", "15 minutes"), translateWithContext("ceasefire", "20 minutes"), translateWithContext("ceasefire", "30 minutes"), translateWithContext("ceasefire", "45 minutes"), translateWithContext("ceasefire", "60 minutes")];
+const CEASEFIRE_DATA = [0, 0.25, 5, 10, 15, 20, 30, 45, 60];
+const CEASEFIRE_DEFAULTIDX = 0;
// Max number of players for any map
const MAX_PLAYERS = 8;
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -203,10 +207,21 @@
g_GameAttributes.settings.StartingResources = STARTING_RESOURCES_DATA[this.selected];
updateGameAttributes();
}
+ var ceasefireL = Engine.GetGUIObjectByName("ceasefire");
+ ceasefireL.list = CEASEFIRE;
+ ceasefireL.list_data = CEASEFIRE_DATA;
+ ceasefireL.selected = CEASEFIRE_DEFAULTIDX;
+ ceasefireL.onSelectionChange = function() {
+ if (this.selected != -1)
+ g_GameAttributes.settings.Ceasefire = CEASEFIRE_DATA[this.selected];
+
+ updateGameAttributes();
+ }
+
var victoryConditions = Engine.GetGUIObjectByName("victoryCondition");
var victories = getVictoryConditions();
victoryConditions.list = victories.text;
victoryConditions.list_data = victories.data;
victoryConditions.onSelectionChange = function() {
@@ -738,10 +753,16 @@
{
var startingResourcesBox = Engine.GetGUIObjectByName("startingResources");
startingResourcesBox.selected = startingResourcesBox.list_data.indexOf(mapSettings.StartingResources);
}
+ if (mapSettings.Ceasefire)
+ {
+ var ceasefireBox = Engine.GetGUIObjectByName("ceasefire");
+ ceasefireBox.selected = ceasefireBox.list_data.indexOf(mapSettings.Ceasefire);
+ }
+
if (attrs.gameSpeed)
{
var gameSpeedBox = Engine.GetGUIObjectByName("gameSpeed");
gameSpeedBox.selected = g_GameSpeeds.speeds.indexOf(attrs.gameSpeed);
}
@@ -1028,10 +1049,11 @@
}
if (!g_GameAttributes.settings.TriggerScripts)
g_GameAttributes.settings.TriggerScripts = g_GameAttributes.settings.VictoryScripts;
else
g_GameAttributes.settings.TriggerScripts = g_GameAttributes.settings.VictoryScripts.concat(g_GameAttributes.settings.TriggerScripts);
+
g_GameStarted = true;
g_GameAttributes.settings.mapType = g_GameAttributes.mapType;
var numPlayers = g_GameAttributes.settings.PlayerData.length;
// Assign random civilizations to players with that choice
// (this is synchronized because we're the host)
@@ -1141,10 +1163,16 @@
{
var startingResourcesBox = Engine.GetGUIObjectByName("startingResources");
startingResourcesBox.selected = startingResourcesBox.list_data.indexOf(mapSettings.StartingResources);
}
+ if (mapSettings.Ceasefire)
+ {
+ var ceasefireBox = Engine.GetGUIObjectByName("ceasefire");
+ ceasefireBox.selected = ceasefireBox.list_data.indexOf(mapSettings.Ceasefire);
+ }
+
initMapNameList();
}
// Controls common to all map types
var numPlayersSelection = Engine.GetGUIObjectByName("numPlayersSelection");
@@ -1156,10 +1184,11 @@
var mapSize = Engine.GetGUIObjectByName("mapSize");
var enableCheats = Engine.GetGUIObjectByName("enableCheats");
var enableRating = Engine.GetGUIObjectByName("enableRating");
var populationCap = Engine.GetGUIObjectByName("populationCap");
var startingResources = Engine.GetGUIObjectByName("startingResources");
+ var ceasefire = Engine.GetGUIObjectByName("ceasefire");
var numPlayersText= Engine.GetGUIObjectByName("numPlayersText");
var mapSizeDesc = Engine.GetGUIObjectByName("mapSizeDesc");
var mapSizeText = Engine.GetGUIObjectByName("mapSizeText");
var revealMapText = Engine.GetGUIObjectByName("revealMapText");
@@ -1169,10 +1198,11 @@
var lockTeamsText = Engine.GetGUIObjectByName("lockTeamsText");
var enableCheatsText = Engine.GetGUIObjectByName("enableCheatsText");
var enableRatingText = Engine.GetGUIObjectByName("enableRatingText");
var populationCapText = Engine.GetGUIObjectByName("populationCapText");
var startingResourcesText = Engine.GetGUIObjectByName("startingResourcesText");
+ var ceasefireText = Engine.GetGUIObjectByName("ceasefireText");
var gameSpeedText = Engine.GetGUIObjectByName("gameSpeedText");
var gameSpeedBox = Engine.GetGUIObjectByName("gameSpeed");
// We have to check for undefined on these properties as not all maps define them.
var sizeIdx = (mapSettings.Size !== undefined && g_MapSizes.tiles.indexOf(mapSettings.Size) != -1 ? g_MapSizes.tiles.indexOf(mapSettings.Size) : g_MapSizes["default"]);
@@ -1195,10 +1225,12 @@
gameSpeedBox.selected = speedIdx;
populationCap.selected = (mapSettings.PopulationCap !== undefined && POPULATION_CAP_DATA.indexOf(mapSettings.PopulationCap) != -1 ? POPULATION_CAP_DATA.indexOf(mapSettings.PopulationCap) : POPULATION_CAP_DEFAULTIDX);
populationCapText.caption = POPULATION_CAP[populationCap.selected];
startingResources.selected = (mapSettings.StartingResources !== undefined && STARTING_RESOURCES_DATA.indexOf(mapSettings.StartingResources) != -1 ? STARTING_RESOURCES_DATA.indexOf(mapSettings.StartingResources) : STARTING_RESOURCES_DEFAULTIDX);
startingResourcesText.caption = STARTING_RESOURCES[startingResources.selected];
+ ceasefire.selected = (mapSettings.Ceasefire !== undefined && CEASEFIRE_DATA.indexOf(mapSettings.Ceasefire) != -1 ? CEASEFIRE_DATA.indexOf(mapSettings.Ceasefire) : CEASEFIRE_DEFAULTIDX);
+ ceasefireText.caption = CEASEFIRE[ceasefire.selected];
// Update map preview
Engine.GetGUIObjectByName("mapPreview").sprite = "cropped:(0.78125,0.5859375)session/icons/mappreview/" + getMapPreview(mapName);
// Hide/show settings depending on whether we can change them or not
@@ -1220,10 +1252,11 @@
updateDisplay(disableTreasures, disableTreasuresText, g_IsController);
updateDisplay(victoryCondition, victoryConditionText, g_IsController);
updateDisplay(lockTeams, lockTeamsText, g_IsController);
updateDisplay(populationCap, populationCapText, g_IsController);
updateDisplay(startingResources, startingResourcesText, g_IsController);
+ updateDisplay(ceasefire, ceasefireText, g_IsController);
if (g_IsController)
{
//Host
numPlayersSelection.selected = numPlayers - 1;
@@ -1262,10 +1295,11 @@
updateDisplay(disableTreasures, disableTreasuresText, g_IsController);
updateDisplay(victoryCondition, victoryConditionText, g_IsController);
updateDisplay(lockTeams, lockTeamsText, g_IsController);
updateDisplay(populationCap, populationCapText, g_IsController);
updateDisplay(startingResources, startingResourcesText, g_IsController);
+ updateDisplay(ceasefire, ceasefireText, g_IsController);
if (g_IsController)
{
//Host
revealMap.checked = (mapSettings.RevealMap ? true : false);
@@ -1288,38 +1322,42 @@
case "scenario":
// For scenario just reflect settings for the current map
numPlayersSelection.hidden = true;
- mapSize.hidden = true;
- revealMap.hidden = true;
- exploreMap.hidden = true;
- disableTreasures.hidden = true;
- victoryCondition.hidden = true;
- lockTeams.hidden = true;
numPlayersText.hidden = false;
+ mapSize.hidden = true;
mapSizeText.hidden = true;
mapSizeDesc.hidden = true;
+ revealMap.hidden = true;
revealMapText.hidden = false;
+ exploreMap.hidden = true;
exploreMapText.hidden = false;
+ disableTreasures.hidden = true;
disableTreasuresText.hidden = false;
+ victoryCondition.hidden = true;
victoryConditionText.hidden = false;
+ lockTeams.hidden = true;
lockTeamsText.hidden = false;
- populationCap.hidden = true;
- populationCapText.hidden = false;
startingResources.hidden = true;
startingResourcesText.hidden = false;
-
+ populationCap.hidden = true;
+ populationCapText.hidden = false;
+ ceasefire.hidden = true;
+ ceasefireText.hidden = false;
+
numPlayersText.caption = numPlayers;
mapSizeText.caption = translate("Default");
revealMapText.caption = (mapSettings.RevealMap ? translate("Yes") : translate("No"));
exploreMapText.caption = (mapSettings.ExploreMap ? translate("Yes") : translate("No"));
disableTreasuresText.caption = translate("No");
victoryConditionText.caption = victories.text[victoryIdx];
lockTeamsText.caption = (mapSettings.LockTeams ? translate("Yes") : translate("No"));
- Engine.GetGUIObjectByName("populationCap").selected = POPULATION_CAP_DEFAULTIDX;
+ startingResourcesText.caption = translate("Determined by scenario");
+ populationCapText.caption = translate("Determined by scenario");
+ ceasefireText.caption = translate("Determined by scenario");
break;
default:
error(sprintf("onGameAttributesChange: Unexpected map type '%(mapType)s'", { mapType: g_GameAttributes.mapType }));
return;
Index: binaries/data/mods/public/gui/gamesetup/gamesetup.xml
===================================================================
--- binaries/data/mods/public/gui/gamesetup/gamesetup.xml (http://svn.wildfiregames.com/public/ps/trunk) (revision 16614)
+++ binaries/data/mods/public/gui/gamesetup/gamesetup.xml (working copy)
@@ -268,11 +268,11 @@
-