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 @@
+
Teams Locked:
-
+
Cheats:
-
+
+
+
+
+
+
-
+
diff --git a/binaries/data/mods/public/simulation/helpers/Setup.js b/binaries/data/mods/public/simulation/helpers/Setup.js
index 0d7a012a8f..7d22983a4c 100644
--- a/binaries/data/mods/public/simulation/helpers/Setup.js
+++ b/binaries/data/mods/public/simulation/helpers/Setup.js
@@ -36,6 +36,16 @@ function LoadMapSettings(settings)
cmpObstructionManager.SetPassabilityCircular(true);
}
+ if (settings.ExploreMap)
+ {
+ // this needs to happen after changing the map to a circular one
+ // as by making the map circular, the explored tiles get reset
+ var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
+ if (cmpRangeManager)
+ for (var i = 0; i < settings.PlayerData.length; i++)
+ cmpRangeManager.ExploreAllTiles(i+1);
+ }
+
var cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager);
if (settings.GameType)
cmpEndGameManager.SetGameType(settings.GameType);
diff --git a/source/simulation2/components/CCmpRangeManager.cpp b/source/simulation2/components/CCmpRangeManager.cpp
index 64ab8c0f1c..a281332b4d 100644
--- a/source/simulation2/components/CCmpRangeManager.cpp
+++ b/source/simulation2/components/CCmpRangeManager.cpp
@@ -1430,6 +1430,21 @@ public:
return m_SharedLosMasks[player];
}
+ void ExploreAllTiles(player_id_t p)
+ {
+ for (u16 j = 0; j < m_TerrainVerticesPerSide; ++j)
+ {
+ for (u16 i = 0; i < m_TerrainVerticesPerSide; ++i)
+ {
+ if (LosIsOffWorld(i,j))
+ continue;
+ u32 &explored = m_ExploredVertices.at(p);
+ explored += !(m_LosState[i + j*m_TerrainVerticesPerSide] & (LOS_EXPLORED << (2*(p-1))));
+ m_LosState[i + j*m_TerrainVerticesPerSide] |= (LOS_EXPLORED << (2*(p-1)));
+ }
+ }
+ }
+
void UpdateTerritoriesLos()
{
CmpPtr cmpTerritoryManager(GetSystemEntity());
diff --git a/source/simulation2/components/ICmpRangeManager.cpp b/source/simulation2/components/ICmpRangeManager.cpp
index 725b6b9eaf..f72a11fb26 100644
--- a/source/simulation2/components/ICmpRangeManager.cpp
+++ b/source/simulation2/components/ICmpRangeManager.cpp
@@ -46,6 +46,7 @@ DEFINE_INTERFACE_METHOD_3("SetEntityFlag", void, ICmpRangeManager, SetEntityFlag
DEFINE_INTERFACE_METHOD_1("GetEntityFlagMask", u8, ICmpRangeManager, GetEntityFlagMask, std::string)
DEFINE_INTERFACE_METHOD_1("GetEntitiesByPlayer", std::vector, ICmpRangeManager, GetEntitiesByPlayer, player_id_t)
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpRangeManager, SetDebugOverlay, bool)
+DEFINE_INTERFACE_METHOD_1("ExploreAllTiles", void, ICmpRangeManager, ExploreAllTiles, player_id_t)
DEFINE_INTERFACE_METHOD_2("SetLosRevealAll", void, ICmpRangeManager, SetLosRevealAll, player_id_t, bool)
DEFINE_INTERFACE_METHOD_1("GetLosRevealAll", bool, ICmpRangeManager, GetLosRevealAll, player_id_t)
DEFINE_INTERFACE_METHOD_5("GetElevationAdaptedRange", entity_pos_t, ICmpRangeManager, GetElevationAdaptedRange, CFixedVector3D, CFixedVector3D, entity_pos_t, entity_pos_t, entity_pos_t)
diff --git a/source/simulation2/components/ICmpRangeManager.h b/source/simulation2/components/ICmpRangeManager.h
index 61584343a2..f68a2d75c8 100644
--- a/source/simulation2/components/ICmpRangeManager.h
+++ b/source/simulation2/components/ICmpRangeManager.h
@@ -332,6 +332,11 @@ public:
*/
std::string GetLosVisibility_wrapper(entity_id_t ent, player_id_t player, bool forceRetainInFog);
+ /**
+ * Explore all tiles (but leave them in the FoW) for player p
+ */
+ virtual void ExploreAllTiles(player_id_t p) = 0;
+
/**
* Set whether the whole map should be made visible to the given player.
* If player is -1, the map will be made visible to all players.