Skip to content

Commit 6cfcc7b

Browse files
authored
fix: Fix incorrect argument used for isInSaveDirectory() (#1849)
1 parent 35b3f01 commit 6cfcc7b

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,19 +2146,17 @@ void GameLogic::loadMapINI( AsciiString mapName )
21462146
return;
21472147
}
21482148

2149-
char filename[_MAX_PATH];
2150-
char fullFledgeFilename[_MAX_PATH];
2151-
21522149
//
21532150
// if map name begins with a "SAVE_DIRECTORY\", then the map refers to a map
21542151
// that has been extracted from a save game file ... in that case we need to get
21552152
// the pristine map name string in order to manipulate and load the right map.ini
21562153
// for that map from it's original location
21572154
//
2158-
const char* pristineMapName = TheGameState->isInSaveDirectory(filename)
2155+
const char* pristineMapName = TheGameState->isInSaveDirectory(mapName.str())
21592156
? TheGameState->getSaveGameInfo()->pristineMapName.str()
21602157
: mapName.str();
21612158

2159+
char filename[_MAX_PATH];
21622160
strlcpy(filename, pristineMapName, ARRAY_SIZE(filename));
21632161

21642162
// sanity
@@ -2175,6 +2173,7 @@ void GameLogic::loadMapINI( AsciiString mapName )
21752173
*extension = 0;
21762174

21772175

2176+
char fullFledgeFilename[_MAX_PATH];
21782177
sprintf(fullFledgeFilename, "%s\\map.ini", filename);
21792178
if (TheFileSystem->doesFileExist(fullFledgeFilename)) {
21802179
DEBUG_LOG(("Loading map.ini"));

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,19 +2463,17 @@ void GameLogic::loadMapINI( AsciiString mapName )
24632463
return;
24642464
}
24652465

2466-
char filename[_MAX_PATH];
2467-
char fullFledgeFilename[_MAX_PATH];
2468-
24692466
//
24702467
// if map name begins with a "SAVE_DIRECTORY\", then the map refers to a map
24712468
// that has been extracted from a save game file ... in that case we need to get
24722469
// the pristine map name string in order to manipulate and load the right map.ini
24732470
// for that map from it's original location
24742471
//
2475-
const char* pristineMapName = TheGameState->isInSaveDirectory(filename)
2472+
const char* pristineMapName = TheGameState->isInSaveDirectory(mapName.str())
24762473
? TheGameState->getSaveGameInfo()->pristineMapName.str()
24772474
: mapName.str();
24782475

2476+
char filename[_MAX_PATH];
24792477
strlcpy(filename, pristineMapName, ARRAY_SIZE(filename));
24802478

24812479
// sanity
@@ -2492,6 +2490,7 @@ void GameLogic::loadMapINI( AsciiString mapName )
24922490
*extension = 0;
24932491

24942492

2493+
char fullFledgeFilename[_MAX_PATH];
24952494
sprintf(fullFledgeFilename, "%s\\map.ini", filename);
24962495
if (TheFileSystem->doesFileExist(fullFledgeFilename)) {
24972496
DEBUG_LOG(("Loading map.ini"));

0 commit comments

Comments
 (0)