Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameengine): hide the generated maps behind -randommaps

Olcay Seygan7121f991b814
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b0aca9c9..86f5b7212 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1060,6 +1060,10 @@ found and fixed — EA's own, not port damage.**
entry in the map cache. The name still says which map it is, so the replay of a generated match
plays back on any machine: it rebuilds the same ground from the same name, and so does anybody
who joins.
+- The generated maps are out of the skirmish map list for now. The generator still deals a seed a
+ match should not be played on - a supply dock behind a cliff, a start with one way out - and a
+ map list is the wrong place to meet one. They are still there on the command line, where
+ `-randommap` names the seed being played, and `-randommaps` puts the rows back in the list.
---
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index c9b32eba7..7fd9f3564 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -409,6 +409,7 @@ public:
AsciiString m_lanPlayerName; ///< -lanname <name>: the name this copy takes in the LAN lobby (empty = the one in the preferences)
Bool m_lanLobbyOnStart; ///< -lanlobby: open the LAN lobby instead of stopping at the main menu
Bool m_skirmishLobbyOnStart; ///< -skirmishlobby: open the skirmish staging room instead of stopping at the main menu
+ Bool m_randomMapsInMenus; ///< -randommaps: offer the generated maps in the map lists (off until the generator is finished)
Int m_maxParticleCount; ///< maximum number of particles that can exist
Int m_maxFieldParticleCount; ///< maximum number of field-type particles that can exist (roughly)
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
index b117d02c6..d62b64a4c 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
@@ -1842,6 +1842,18 @@ Int parseSkirmishLobby(char *args[], int num)
return 1;
}
+/* -randommaps puts the generated maps back in the skirmish map list. They are off by default
+ because the generator is not finished - a seed can still leave a supply dock behind a cliff, and
+ a map list is not the place to find that out. Everything else about them works from the command
+ line, where -randommap says exactly which map is being played. */
+Int parseRandomMapsInMenus(char *args[], int num)
+{
+ if (TheWritableGlobalData)
+ TheWritableGlobalData->m_randomMapsInMenus = TRUE;
+
+ return 1;
+}
+
Int parseNetSlot(char *args[], int num)
{
if (TheWritableGlobalData && num > 1)
@@ -2072,6 +2084,7 @@ static CommandLineParam params[] =
match itself is simulated - the command-line twin of the skirmish menu's game speed slider. */
{ "-map", parseMapName },
{ "-randommap", parseRandomMap },
+ { "-randommaps", parseRandomMapsInMenus },
{ "-seed", parseSeed },
{ "-noFPSLimit", parseNoFPSLimit },
{ "-fps", parseFPSLimit },
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index a1a31a7e5..f01cd2292 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -719,6 +719,7 @@ GlobalData::GlobalData()
m_lanPlayerName.clear(); // the lobby name comes out of the preferences unless -lanname says otherwise
m_lanLobbyOnStart = FALSE;
m_skirmishLobbyOnStart = FALSE;
+ m_randomMapsInMenus = FALSE;
m_horizontalScrollSpeedFactor = 1.0;
m_verticalScrollSpeedFactor = 1.0;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp
index 5d45fb12a..7c9547956 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp
@@ -88,9 +88,14 @@ static Bool isRandomMapRow( const char *itemData )
return randomMapSizeOfRow( itemData ) != RANDOM_MAP_SIZE_COUNT;
}
+/** The three generated map rows, which are only offered when -randommaps asks for them. The
+ generator still hands out seeds a match should not be played on - a supply dock behind a cliff,
+ a start with one way out - and the map list is the wrong place to meet one, so until it is
+ finished the maps are reached from the command line, where -randommap names the seed being
+ played and a bad one can simply be dropped. */
static void addRandomMapRows( GameWindow *listbox )
{
- if( listbox == NULL )
+ if( listbox == NULL || TheGlobalData == NULL || !TheGlobalData->m_randomMapsInMenus )
return;
// Spelled out here rather than fetched: the string tables live in the shipped