From e1488fee5677c9223bd5ec1c0b5c185254a1acce Mon Sep 17 00:00:00 2001 From: sanderd17 Date: Mon, 14 Apr 2014 19:52:49 +0000 Subject: [PATCH] Add an 'explore map' option to the game setup. This was SVN commit r14931. --- .../mods/public/gui/gamesetup/gamesetup.js | 26 +++++++++++++++++++ .../mods/public/gui/gamesetup/gamesetup.xml | 14 +++++++--- .../mods/public/simulation/helpers/Setup.js | 10 +++++++ .../components/CCmpRangeManager.cpp | 15 +++++++++++ .../components/ICmpRangeManager.cpp | 1 + .../simulation2/components/ICmpRangeManager.h | 5 ++++ 6 files changed, 68 insertions(+), 3 deletions(-) diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup.js b/binaries/data/mods/public/gui/gamesetup/gamesetup.js index 0bb823efbb..c65705ee42 100644 --- a/binaries/data/mods/public/gui/gamesetup/gamesetup.js +++ b/binaries/data/mods/public/gui/gamesetup/gamesetup.js @@ -235,6 +235,15 @@ function initMain() updateGameAttributes(); }; + Engine.GetGUIObjectByName("exploreMap").onPress = function() + { // Update attributes so other players can see change + g_GameAttributes.settings.ExploreMap = this.checked; + + if (!g_IsInGuiUpdate) + updateGameAttributes(); + }; + + Engine.GetGUIObjectByName("lockTeams").onPress = function() { // Update attributes so other players can see change g_GameAttributes.settings.LockTeams = this.checked; @@ -933,6 +942,7 @@ function onGameAttributesChange() // Controls common to all map types var numPlayersSelection = Engine.GetGUIObjectByName("numPlayersSelection"); var revealMap = Engine.GetGUIObjectByName("revealMap"); + var exploreMap = Engine.GetGUIObjectByName("exploreMap"); var victoryCondition = Engine.GetGUIObjectByName("victoryCondition"); var lockTeams = Engine.GetGUIObjectByName("lockTeams"); var mapSize = Engine.GetGUIObjectByName("mapSize"); @@ -944,6 +954,7 @@ function onGameAttributesChange() var mapSizeDesc = Engine.GetGUIObjectByName("mapSizeDesc"); var mapSizeText = Engine.GetGUIObjectByName("mapSizeText"); var revealMapText = Engine.GetGUIObjectByName("revealMapText"); + var exploreMapText = Engine.GetGUIObjectByName("exploreMapText"); var victoryConditionText = Engine.GetGUIObjectByName("victoryConditionText"); var lockTeamsText = Engine.GetGUIObjectByName("lockTeamsText"); var enableCheatsText = Engine.GetGUIObjectByName("enableCheatsText"); @@ -977,6 +988,7 @@ function onGameAttributesChange() numPlayersSelection.hidden = false; mapSize.hidden = false; revealMap.hidden = false; + exploreMap.hidden = false; victoryCondition.hidden = false; lockTeams.hidden = false; populationCap.hidden = false; @@ -985,6 +997,7 @@ function onGameAttributesChange() numPlayersText.hidden = true; mapSizeText.hidden = true; revealMapText.hidden = true; + exploreMapText.hidden = true; victoryConditionText.hidden = true; lockTeamsText.hidden = true; populationCapText.hidden = true; @@ -993,7 +1006,9 @@ function onGameAttributesChange() mapSizeText.caption = "Map size:"; mapSize.selected = sizeIdx; revealMapText.caption = "Reveal map:"; + exploreMapText.caption = "Explore map:"; revealMap.checked = (mapSettings.RevealMap ? true : false); + exploreMap.checked = (mapSettings.ExploreMap ? true : false); victoryConditionText.caption = "Victory condition:"; victoryCondition.selected = victoryIdx; @@ -1006,6 +1021,7 @@ function onGameAttributesChange() numPlayersText.hidden = false; mapSizeText.hidden = false; revealMapText.hidden = false; + exploreMapText.hidden = false; victoryConditionText.hidden = false; lockTeamsText.hidden = false; populationCap.hidden = true; @@ -1016,6 +1032,7 @@ function onGameAttributesChange() numPlayersText.caption = numPlayers; mapSizeText.caption = g_MapSizes.names[sizeIdx]; revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No"); + exploreMapText.caption = (mapSettings.ExloreMap ? "Yes" : "No"); victoryConditionText.caption = VICTORY_TEXT[victoryIdx]; lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No"); } @@ -1033,6 +1050,7 @@ function onGameAttributesChange() { //Host revealMap.hidden = false; + exploreMap.hidden = false; victoryCondition.hidden = false; lockTeams.hidden = false; populationCap.hidden = false; @@ -1040,13 +1058,16 @@ function onGameAttributesChange() numPlayersText.hidden = false; revealMapText.hidden = true; + exploreMapText.hidden = true; victoryConditionText.hidden = true; lockTeamsText.hidden = true; populationCapText.hidden = true; startingResourcesText.hidden = true; revealMapText.caption = "Reveal map:"; + exploreMapText.caption = "Explore map:"; revealMap.checked = (mapSettings.RevealMap ? true : false); + exploreMap.checked = (mapSettings.ExploreMap ? true : false); victoryConditionText.caption = "Victory condition:"; victoryCondition.selected = victoryIdx; @@ -1058,6 +1079,7 @@ function onGameAttributesChange() // Client numPlayersText.hidden = false; revealMapText.hidden = false; + exploreMapText.hidden = false; victoryConditionText.hidden = false; lockTeamsText.hidden = false; populationCap.hidden = true; @@ -1066,6 +1088,7 @@ function onGameAttributesChange() startingResourcesText.hidden = false; revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No"); + exploreMapText.caption = (mapSettings.ExploreMap ? "Yes" : "No"); victoryConditionText.caption = VICTORY_TEXT[victoryIdx]; lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No"); } @@ -1078,12 +1101,14 @@ function onGameAttributesChange() numPlayersSelection.hidden = true; mapSize.hidden = true; revealMap.hidden = true; + exploreMap.hidden = true; victoryCondition.hidden = true; lockTeams.hidden = true; numPlayersText.hidden = false; mapSizeText.hidden = true; mapSizeDesc.hidden = true; revealMapText.hidden = false; + exploreMapText.hidden = false; victoryConditionText.hidden = false; lockTeamsText.hidden = false; populationCap.hidden = true; @@ -1094,6 +1119,7 @@ function onGameAttributesChange() numPlayersText.caption = numPlayers; mapSizeText.caption = "Default"; revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No"); + exploreMapText.caption = (mapSettings.ExploreMap ? "Yes" : "No"); victoryConditionText.caption = VICTORY_TEXT[victoryIdx]; lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No"); Engine.GetGUIObjectByName("populationCap").selected = POPULATION_CAP_DEFAULTIDX; diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup.xml b/binaries/data/mods/public/gui/gamesetup/gamesetup.xml index 6163d60df5..ef68cbacd8 100644 --- a/binaries/data/mods/public/gui/gamesetup/gamesetup.xml +++ b/binaries/data/mods/public/gui/gamesetup/gamesetup.xml @@ -276,21 +276,29 @@ Reveal Map: + Explore Map: + + Teams Locked: -