Skip to content

Commit 85add1a

Browse files
committed
refactor(map): Remove unused variables from loadMap and loadUserMaps functions
1 parent f3e4ea2 commit 85add1a

File tree

2 files changed

+6
-52
lines changed

2 files changed

+6
-52
lines changed

Generals/Code/GameEngine/Source/GameClient/MapUtil.cpp

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -216,25 +216,12 @@ static Bool ParseSizeOnlyInChunk(DataChunkInput &file, DataChunkInfo *info, void
216216
return ParseSizeOnly(file, info, userData);
217217
}
218218

219+
// TheSuperHackers @refactor bobtista 31/10/2025 Remove unused variables. Function only uses filename directly.
219220
static Bool loadMap( AsciiString filename )
220221
{
221-
char tempBuf[_MAX_PATH];
222-
char filenameBuf[_MAX_PATH];
223-
AsciiString asciiFile;
224-
int length = 0;
225-
226-
strcpy(tempBuf, filename.str());
227-
228-
length = strlen( tempBuf );
229-
if( length >= 4 )
230-
{
231-
strlcpy( filenameBuf, tempBuf, length - 4 + 1);
232-
}
233-
234222
CachedFileInputStream fileStrm;
235223

236-
asciiFile = filename;
237-
if( !fileStrm.open(asciiFile) )
224+
if( !fileStrm.open(filename) )
238225
{
239226
return FALSE;
240227
}
@@ -579,18 +566,8 @@ Bool MapCache::loadUserMaps()
579566
}
580567
else
581568
{
569+
// TheSuperHackers @refactor bobtista 31/10/2025 Remove unused code block that parsed filename but never used result.
582570
if (TheFileSystem->getFileInfo(tempfilename, &fileInfo)) {
583-
char funk[_MAX_PATH];
584-
strcpy(funk, tempfilename.str());
585-
char *filenameptr = funk;
586-
char *tempchar = funk;
587-
while (*tempchar != 0) {
588-
if ((*tempchar == '\\') || (*tempchar == '/')) {
589-
filenameptr = tempchar+1;
590-
}
591-
++tempchar;
592-
}
593-
594571
m_seen[tempfilename] = TRUE;
595572
parsedAMap |= addMap(mapDir, *iter, &fileInfo, TheGlobalData->m_buildMapCache);
596573
} else {

GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -216,25 +216,12 @@ static Bool ParseSizeOnlyInChunk(DataChunkInput &file, DataChunkInfo *info, void
216216
return ParseSizeOnly(file, info, userData);
217217
}
218218

219+
// TheSuperHackers @refactor bobtista 31/10/2025 Remove unused variables. Function only uses filename directly.
219220
static Bool loadMap( AsciiString filename )
220221
{
221-
char tempBuf[_MAX_PATH];
222-
char filenameBuf[_MAX_PATH];
223-
AsciiString asciiFile;
224-
int length = 0;
225-
226-
strcpy(tempBuf, filename.str());
227-
228-
length = strlen( tempBuf );
229-
if( length >= 4 )
230-
{
231-
strlcpy( filenameBuf, tempBuf, length - 4 + 1);
232-
}
233-
234222
CachedFileInputStream fileStrm;
235223

236-
asciiFile = filename;
237-
if( !fileStrm.open(asciiFile) )
224+
if( !fileStrm.open(filename) )
238225
{
239226
return FALSE;
240227
}
@@ -581,18 +568,8 @@ Bool MapCache::loadUserMaps()
581568
}
582569
else
583570
{
571+
// TheSuperHackers @refactor bobtista 31/10/2025 Remove unused code block that parsed filename but never used result.
584572
if (TheFileSystem->getFileInfo(tempfilename, &fileInfo)) {
585-
char funk[_MAX_PATH];
586-
strcpy(funk, tempfilename.str());
587-
char *filenameptr = funk;
588-
char *tempchar = funk;
589-
while (*tempchar != 0) {
590-
if ((*tempchar == '\\') || (*tempchar == '/')) {
591-
filenameptr = tempchar+1;
592-
}
593-
++tempchar;
594-
}
595-
596573
m_seen[tempfilename] = TRUE;
597574
parsedAMap |= addMap(mapDir, *iter, &fileInfo, TheGlobalData->m_buildMapCache);
598575
} else {

0 commit comments

Comments
 (0)