File tree Expand file tree Collapse file tree
GeneralsMD/Code/GameEngine/Include/Common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,4 +128,6 @@ class OptionPreferences : public UserPreferences
128128 Real getResolutionFontAdjustment ();
129129
130130 Bool getShowMoneyPerMinute () const ;
131+ Bool getIsMultiInstance () const ;
132+ static Bool readIsMultiInstanceFromPrimaryIni ();
131133};
Original file line number Diff line number Diff line change @@ -872,3 +872,24 @@ Bool OptionPreferences::getShowMoneyPerMinute() const
872872 }
873873 return FALSE ;
874874}
875+
876+ Bool OptionPreferences::getIsMultiInstance () const
877+ {
878+ OptionPreferences::const_iterator it = find (" IsMultiInstance" );
879+ if (it == end ())
880+ return FALSE ;
881+
882+ if (stricmp (it->second .str (), " yes" ) == 0 )
883+ {
884+ return TRUE ;
885+ }
886+ return FALSE ;
887+ }
888+
889+ Bool OptionPreferences::readIsMultiInstanceFromPrimaryIni ()
890+ {
891+ OptionPreferences op;
892+ // We call getBool directly to avoid the const_iterator logic in getIsMultiInstance which defaults to FALSE.
893+ // We want to default to TRUE for multi-instance if not specified (legacy behavior for debug).
894+ return op.getBool (" IsMultiInstance" , TRUE );
895+ }
Original file line number Diff line number Diff line change 6161#include " Common/CommandLine.h"
6262#include " Common/Debug.h"
6363#include " Common/CRCDebug.h"
64+ #include " Common/OptionPreferences.h"
6465#include " Common/UnicodeString.h"
6566#include " GameClient/ClientInstance.h"
6667#include " GameClient/GameText.h"
@@ -373,6 +374,8 @@ void DebugInit(int flags)
373374 // Determine the client instance id before creating the log file with an instance specific name.
374375 CommandLine::parseCommandLineForStartup ();
375376
377+ rts::ClientInstance::setMultiInstance (OptionPreferences::readIsMultiInstanceFromPrimaryIni ());
378+
376379 if (!rts::ClientInstance::initialize ())
377380 return ;
378381
Original file line number Diff line number Diff line change @@ -25,11 +25,8 @@ namespace rts
2525HANDLE ClientInstance::s_mutexHandle = nullptr ;
2626UnsignedInt ClientInstance::s_instanceIndex = 0 ;
2727
28- #if defined(RTS_MULTI_INSTANCE)
2928Bool ClientInstance::s_isMultiInstance = true ;
30- #else
31- Bool ClientInstance::s_isMultiInstance = false ;
32- #endif
29+
3330
3431bool ClientInstance::initialize ()
3532{
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ class GlobalData : public SubsystemInterface
9090
9191 static void parseGameDataDefinition ( INI * ini );
9292 void parseCustomDefinition ();
93+ void initUserDataPath ();
9394
9495 // -----------------------------------------------------------------------------------------------
9596 struct TerrainLighting
Original file line number Diff line number Diff line change @@ -1040,6 +1040,8 @@ GlobalData::GlobalData()
10401040
10411041 m_clientRetaliationModeEnabled = TRUE ; // On by default.
10421042
1043+ m_userDataLeafName = " Command and Conquer Generals Data" ;
1044+ m_userDataDir = BuildUserDataPathFromIni (m_userDataLeafName);
10431045}
10441046
10451047// -------------------------------------------------------------------------------------------------
@@ -1181,7 +1183,7 @@ void GlobalData::parseGameDataDefinition( INI* ini )
11811183 ini->initFromINI ( TheWritableGlobalData, s_GlobalDataFieldParseTable );
11821184
11831185 TheWritableGlobalData->m_userDataDir .clear ();
1184- TheWritableGlobalData->m_userDataDir = BuildUserDataPathFromIni ();
1186+ TheWritableGlobalData->m_userDataDir = BuildUserDataPathFromIni (m_userDataLeafName );
11851187 CreateDirectory (TheWritableGlobalData->m_userDataDir .str (), nullptr );
11861188
11871189 // override INI values with user preferences
@@ -1360,7 +1362,7 @@ AsciiString GlobalData::BuildUserDataPathFromIni()
13601362 if (!myDocumentsDirectory.endsWith (" \\ " ))
13611363 myDocumentsDirectory.concat (' \\ ' );
13621364
1363- myDocumentsDirectory.concat (TheWritableGlobalData-> m_userDataLeafName .str ());
1365+ myDocumentsDirectory.concat (leafName .str ());
13641366
13651367 if (!myDocumentsDirectory.endsWith (" \\ " ))
13661368 myDocumentsDirectory.concat (' \\ ' );
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ class GlobalData : public SubsystemInterface
9191
9292 static void parseGameDataDefinition ( INI * ini );
9393 void parseCustomDefinition ();
94+ void initUserDataPath ();
9495
9596 // -----------------------------------------------------------------------------------------------
9697 struct TerrainLighting
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ set_property(CACHE RTS_DEBUG_PROFILE PROPERTY STRINGS DEFAULT ON OFF)
1212
1313option (RTS_DEBUG_CHEATS "Enables debug cheats in release builds" OFF )
1414option (RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Includes normal debug log in crc log" OFF )
15- option (RTS_DEBUG_MULTI_INSTANCE "Enables multi client instance support" OFF )
1615
1716
1817# Helper macro that handles DEFAULT ON OFF options
@@ -38,7 +37,6 @@ define_debug_option(RTS_DEBUG_PROFILE DEBUG_PROFILE DISABLE_DEBUG_PROFILE
3837
3938add_feature_info (DebugCheats RTS_DEBUG_CHEATS "Build with Debug Cheats in release builds" )
4039add_feature_info (DebugIncludeDebugLogInCrcLog RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Build with Debug Logging in CRC log" )
41- add_feature_info (DebugMultiInstance RTS_DEBUG_MULTI_INSTANCE "Build with Multi Client Instance support" )
4240
4341
4442if (RTS_DEBUG_CHEATS)
@@ -49,6 +47,3 @@ if(RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG)
4947 target_compile_definitions (core_config INTERFACE INCLUDE_DEBUG_LOG_IN_CRC_LOG )
5048endif ()
5149
52- if (RTS_DEBUG_MULTI_INSTANCE)
53- target_compile_definitions (core_config INTERFACE RTS_MULTI_INSTANCE )
54- endif ()
You can’t perform that action at this time.
0 commit comments