Skip to content

Commit f3e4ea2

Browse files
committed
refactor(map): Remove unused variables and parameter from calcCRC function
1 parent cf55e87 commit f3e4ea2

File tree

2 files changed

+8
-34
lines changed

2 files changed

+8
-34
lines changed

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

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,13 @@ static Coord3DList m_techPositions;
8181
static Int m_mapDX = 0;
8282
static Int m_mapDY = 0;
8383

84-
static UnsignedInt calcCRC( AsciiString dirName, AsciiString fname )
84+
// TheSuperHackers @refactor bobtista 31/10/2025 Remove unused variables and parameter. Function only uses fname directly.
85+
static UnsignedInt calcCRC( AsciiString fname )
8586
{
8687
CRC theCRC;
8788
theCRC.clear();
8889

89-
// Try the official map dir
90-
AsciiString asciiFile;
91-
char tempBuf[_MAX_PATH];
92-
char filenameBuf[_MAX_PATH];
93-
int length = 0;
94-
strcpy(tempBuf, fname.str());
95-
length = strlen( tempBuf );
96-
if( length >= 4 )
97-
{
98-
strlcpy( filenameBuf, tempBuf, length - 4 + 1);
99-
}
100-
101-
File *fp;
102-
asciiFile = fname;
103-
fp = TheFileSystem->openFile(asciiFile.str(), File::READ);
90+
File *fp = TheFileSystem->openFile(fname.str(), File::READ);
10491
if( !fp )
10592
{
10693
DEBUG_CRASH(("Couldn't open '%s'", fname.str()));
@@ -672,7 +659,7 @@ Bool MapCache::addMap( AsciiString dirName, AsciiString fname, FileInfo *fileInf
672659
md.m_timestamp.m_lowTimeStamp = fileInfo->timestampLow;
673660
md.m_supplyPositions = m_supplyPositions;
674661
md.m_techPositions = m_techPositions;
675-
md.m_CRC = calcCRC(dirName, fname);
662+
md.m_CRC = calcCRC(fname);
676663

677664
Bool exists = false;
678665
AsciiString munkee = worldDict.getAsciiString(TheKey_mapName, &exists);

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

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,13 @@ static Coord3DList m_techPositions;
8181
static Int m_mapDX = 0;
8282
static Int m_mapDY = 0;
8383

84-
static UnsignedInt calcCRC( AsciiString dirName, AsciiString fname )
84+
// TheSuperHackers @refactor bobtista 31/10/2025 Remove unused variables and parameter. Function only uses fname directly.
85+
static UnsignedInt calcCRC( AsciiString fname )
8586
{
8687
CRC theCRC;
8788
theCRC.clear();
8889

89-
// Try the official map dir
90-
AsciiString asciiFile;
91-
char tempBuf[_MAX_PATH];
92-
char filenameBuf[_MAX_PATH];
93-
int length = 0;
94-
strcpy(tempBuf, fname.str());
95-
length = strlen( tempBuf );
96-
if( length >= 4 )
97-
{
98-
strlcpy( filenameBuf, tempBuf, length - 4 + 1);
99-
}
100-
101-
File *fp;
102-
asciiFile = fname;
103-
fp = TheFileSystem->openFile(asciiFile.str(), File::READ);
90+
File *fp = TheFileSystem->openFile(fname.str(), File::READ);
10491
if( !fp )
10592
{
10693
DEBUG_CRASH(("Couldn't open '%s'", fname.str()));
@@ -699,7 +686,7 @@ Bool MapCache::addMap( AsciiString dirName, AsciiString fname, FileInfo *fileInf
699686
md.m_timestamp.m_lowTimeStamp = fileInfo->timestampLow;
700687
md.m_supplyPositions = m_supplyPositions;
701688
md.m_techPositions = m_techPositions;
702-
md.m_CRC = calcCRC(dirName, fname);
689+
md.m_CRC = calcCRC(fname);
703690

704691
Bool exists = false;
705692
AsciiString munkee = worldDict.getAsciiString(TheKey_mapName, &exists);

0 commit comments

Comments
 (0)