Index: binaries/data/mods/public/gui/gamesetup/gamesetup.js
===================================================================
--- binaries/data/mods/public/gui/gamesetup/gamesetup.js (revision 13133)
+++ binaries/data/mods/public/gui/gamesetup/gamesetup.js (working copy)
@@ -107,7 +107,13 @@
var mapTypes = getGUIObjectByName("mapTypeSelection");
mapTypes.list = ["Scenario","Random"];
mapTypes.list_data = ["scenario","random"];
+
+ // Init Game speed
+ var GameSpeed = getGUIObjectByName("gameSpeedSelection");
+ GameSpeed.list = ["Slow","Normal","Fast","Faster"];
+ GameSpeed.list_data = [0.5,1,1.5,2];
+
// Setup map filters - will appear in order they are added
addFilter("Default", function(settings) { return settings && !keywordTestOR(settings.Keywords, ["naval", "demo", "hidden"]); });
addFilter("Naval Maps", function(settings) { return settings && keywordTestAND(settings.Keywords, ["naval"]); });
@@ -125,7 +131,8 @@
{
mapTypes.selected = 0;
mapFilters.selected = 0;
-
+ GameSpeed.selected=1;
+
initMapNameList();
var numPlayersSelection = getGUIObjectByName("numPlayersSelection");
@@ -245,7 +252,9 @@
getGUIObjectByName("mapSelection").hidden = true;
getGUIObjectByName("victoryConditionText").hidden = false;
getGUIObjectByName("victoryCondition").hidden = true;
-
+ getGUIObjectByName("gameSpeedSelection").hidden = true;
+ getGUIObjectByName("gameSpeedText").hidden = false;
+
// Disable player and game options controls
// TODO: Shouldn't players be able to choose their own assignment?
for (var i = 0; i < MAX_PLAYERS; ++i)
@@ -394,6 +403,7 @@
break;
case "start":
+ Engine.SetSimRate(+(g_GameAttributes.settings.gameSpeed)); // change the GameSpeed
Engine.SwitchGuiPage("page_loading.xml", {
"attribs": g_GameAttributes,
"isNetworked" : g_IsNetworked,
@@ -804,6 +814,27 @@
updateGameAttributes();
}
+
+function selectGameSpeed(speed)
+{
+ // Avoid recursion
+ if (g_IsInGuiUpdate)
+ {
+ return;
+ }
+
+ // Network clients can't change map filter
+ if (g_IsNetworked && !g_IsController)
+ {
+ return;
+ }
+
+ g_GameAttributes.settings.gameSpeed=speed;
+
+
+ updateGameAttributes();
+}
+
function launchGame()
{
if (g_IsNetworked && !g_IsController)
@@ -902,6 +933,7 @@
"playerAssignments": g_PlayerAssignments
});
}
+Engine.SetSimRate(+(g_GameAttributes.settings.gameSpeed)); //change the Gamespeed
}
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -931,6 +963,10 @@
var startingResourcesBox = getGUIObjectByName("startingResources");
startingResourcesBox.selected = startingResourcesBox.list_data.indexOf(mapSettings.StartingResources);
initMapNameList();
+
+ var gameSpeedSelection = getGUIObjectByName("gameSpeedSelection");
+ var indexGameSpeed = gameSpeedSelection.list_data.indexOf(g_GameAttributes.settings.gameSpeed);
+ getGUIObjectByName("gameSpeedText").caption = gameSpeedSelection.list[indexGameSpeed];
}
// Controls common to all map types
@@ -939,6 +975,7 @@
var victoryCondition = getGUIObjectByName("victoryCondition");
var lockTeams = getGUIObjectByName("lockTeams");
var mapSize = getGUIObjectByName("mapSize");
+ var gameSpeed = getGUIObjectByName("gameSpeed");
var enableCheats = getGUIObjectByName("enableCheats");
var populationCap = getGUIObjectByName("populationCap");
var startingResources = getGUIObjectByName("startingResources");
@@ -948,6 +985,7 @@
var revealMapText = getGUIObjectByName("revealMapText");
var victoryConditionText = getGUIObjectByName("victoryConditionText");
var lockTeamsText = getGUIObjectByName("lockTeamsText");
+ var gameSpeedText = getGUIObjectByName("gameSpeedText");
var enableCheatsText = getGUIObjectByName("enableCheatsText");
var populationCapText = getGUIObjectByName("populationCapText");
var startingResourcesText = getGUIObjectByName("startingResourcesText");
Index: binaries/data/mods/public/gui/gamesetup/gamesetup.xml
===================================================================
--- binaries/data/mods/public/gui/gamesetup/gamesetup.xml (revision 13133)
+++ binaries/data/mods/public/gui/gamesetup/gamesetup.xml (working copy)
@@ -95,27 +95,38 @@
-
+
+
+
+
+
+
+
-
+
Match Type:
Map Filter:
Select Map:
Map Size:
+ Game Speed:
+
+
selectMapType(this.list_data[this.selected]);
@@ -124,13 +135,13 @@
selectMapFilter(this.list[this.selected]);
-
+
+
+
+
+
+ selectGameSpeed(this.list_data[this.selected]);
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
@@ -159,7 +186,7 @@
-
+