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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameclient): skirmish room keeps a random map after a match
Olcay Seygan78f252de22c1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4551a8d95..97732e7e5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -25,6 +25,7 @@ found and fixed, EA's own, not port damage.**- In a LAN or online room the other players do not download anything: the map's name carries its recipe, and their own game builds the same map from it and checks it against yours. A room that records stats keeps to the official list.- Random maps used to be reachable only by a hidden command-line switch that added five rows to the skirmish list.- Leaving the skirmish room for the main menu no longer crashes the game. In 3.4.0 it did every time, whatever map was picked: the room went on refitting its random map to the seats for a moment after Back had already thrown the seats away.+- Back from a match on a random map, the skirmish room still has that map picked. It used to show some other map, usually the first of your own downloaded ones, because the room wrote the map's name down in a way it could not read back. The room also picks up a random map remembered from your last session, building it again from its name.## An army screen in every lobbydiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cppindex f5585d599..5027b75e8 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp@@ -418,7 +418,9 @@ Bool SkirmishPreferences::write(void)(*this)["PlayerTemplate"] = PlayerTemplatePreference(TheSkirmishGameInfo->getConstSlot(0)->getPlayerTemplate());- (*this)["Map"] = TheSkirmishGameInfo->getMap();+ // read back through QuotedPrintableToAsciiString, whose escape is '_': a generated map's+ // "rmg_v17_..." written as it is came back as garbage and the room fell back to another map+ (*this)["Map"] = AsciiStringToQuotedPrintable(TheSkirmishGameInfo->getMap());(*this)["UserName"] = UnicodeStringToQuotedPrintable(TheSkirmishGameInfo->getConstSlot(0)->getName());diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cppindex cf87c39ea..56526d6c4 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp@@ -1182,17 +1182,11 @@ Bool isValidMap( AsciiString mapName, Bool isMultiplayer )return FALSE;TheMapCache->updateCache();- mapName.toLower();- MapCache::iterator it = TheMapCache->find(mapName);- if (it != TheMapCache->end())- {- if (isMultiplayer == it->second.m_isMultiplayer)- {- return TRUE;- }- }-- return FALSE;+ // findMap, not find: a generated map is in the cache only while the generator holds it, and one+ // it has let go of - the room's map after a match, the one remembered from the last run - is+ // still a map, built again from its name+ const MapMetaData *md = TheMapCache->findMap(mapName);+ return md != NULL && isMultiplayer == md->m_isMultiplayer;} // end isValidMap//-------------------------------------------------------------------------------------------------