Skip to content

Commit 75d5937

Browse files
authored
refactor: Simplify unconditional asserts from DEBUG_ASSERTCRASH to DEBUG_CRASH (TheSuperHackers#2343)
1 parent 8fa92a8 commit 75d5937

89 files changed

Lines changed: 205 additions & 205 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Core/GameEngine/Source/Common/INI/INI.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ UnsignedInt INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer )
436436
}
437437
else
438438
{
439-
DEBUG_ASSERTCRASH( 0, ("[LINE: %d - FILE: '%s'] Unknown block '%s'",
439+
DEBUG_CRASH( ("[LINE: %d - FILE: '%s'] Unknown block '%s'",
440440
getLineNum(), getFilename().str(), token ) );
441441
throw INI_UNKNOWN_TOKEN;
442442
}
@@ -524,7 +524,7 @@ void INI::readLine( void )
524524
// check for at the max
525525
if ( p == m_buffer+INI_MAX_CHARS_PER_LINE )
526526
{
527-
DEBUG_ASSERTCRASH( 0, ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE", INI_MAX_CHARS_PER_LINE) );
527+
DEBUG_CRASH( ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE", INI_MAX_CHARS_PER_LINE) );
528528
}
529529
}
530530

@@ -1524,7 +1524,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
15241524

15251525
if( what == nullptr )
15261526
{
1527-
DEBUG_ASSERTCRASH( 0, ("INI::initFromINI - Invalid parameters supplied!") );
1527+
DEBUG_CRASH( ("INI::initFromINI - Invalid parameters supplied!") );
15281528
throw INI_INVALID_PARAMS;
15291529
}
15301530

@@ -1578,7 +1578,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
15781578

15791579
if (!found)
15801580
{
1581-
DEBUG_ASSERTCRASH( 0, ("[LINE: %d - FILE: '%s'] Unknown field '%s' in block '%s'",
1581+
DEBUG_CRASH( ("[LINE: %d - FILE: '%s'] Unknown field '%s' in block '%s'",
15821582
INI::getLineNum(), INI::getFilename().str(), field, m_curBlockStart) );
15831583
}
15841584

@@ -1591,7 +1591,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
15911591
{
15921592

15931593
done = TRUE;
1594-
DEBUG_ASSERTCRASH( 0, ("Error parsing block '%s', in INI file '%s'. Missing '%s' token",
1594+
DEBUG_CRASH( ("Error parsing block '%s', in INI file '%s'. Missing '%s' token",
15951595
m_curBlockStart, getFilename().str(), m_blockEndToken) );
15961596
throw INI_MISSING_END_TOKEN;
15971597

@@ -1667,7 +1667,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
16671667
if( nameList == nullptr || nameList[ 0 ] == nullptr )
16681668
{
16691669

1670-
DEBUG_ASSERTCRASH( 0, ("INTERNAL ERROR! scanIndexList, invalid name list") );
1670+
DEBUG_CRASH( ("INTERNAL ERROR! scanIndexList, invalid name list") );
16711671
throw INI_INVALID_NAME_LIST;
16721672

16731673
}
@@ -1692,7 +1692,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
16921692
{
16931693
if( lookupList == nullptr || lookupList[ 0 ].name == nullptr )
16941694
{
1695-
DEBUG_ASSERTCRASH( 0, ("INTERNAL ERROR! scanLookupList, invalid name list") );
1695+
DEBUG_CRASH( ("INTERNAL ERROR! scanLookupList, invalid name list") );
16961696
throw INI_INVALID_NAME_LIST;
16971697
}
16981698

Core/GameEngine/Source/Common/System/Radar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ Bool Radar::removeObject( Object *obj )
478478
return TRUE;
479479
else
480480
{
481-
DEBUG_ASSERTCRASH( 0, ("Radar: Tried to remove object '%s' which was not found",
481+
DEBUG_CRASH( ("Radar: Tried to remove object '%s' which was not found",
482482
obj->getTemplate()->getName().str()) );
483483
return FALSE;
484484
}

Core/GameEngine/Source/GameClient/Credits.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ void CreditsManager::addText( AsciiString text )
460460
}
461461
break;
462462
default:
463-
DEBUG_ASSERTCRASH( FALSE, ("CreditsManager::addText we tried to add a credit text with the wrong style before it. Style is %d", m_currentStyle) );
463+
DEBUG_CRASH( ("CreditsManager::addText we tried to add a credit text with the wrong style before it. Style is %d", m_currentStyle) );
464464
delete cLine;
465465
}
466466

Core/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Transition *getTransitionForStyle( Int style )
135135
return NEW ScoreScaleUpTransition;
136136

137137
default:
138-
DEBUG_ASSERTCRASH(FALSE, ("getTransitionForStyle:: An invalid style was passed in. Style = %d", style));
138+
DEBUG_CRASH(("getTransitionForStyle:: An invalid style was passed in. Style = %d", style));
139139
return nullptr;
140140
}
141141
return nullptr;
@@ -532,7 +532,7 @@ TransitionGroup *GameWindowTransitionsHandler::getNewGroup( AsciiString name )
532532
// test to see if we're trying to add an already existing group.
533533
if(findGroup(name))
534534
{
535-
DEBUG_ASSERTCRASH(FALSE, ("GameWindowTransitionsHandler::getNewGroup - We already have a group %s", name.str()));
535+
DEBUG_CRASH(("GameWindowTransitionsHandler::getNewGroup - We already have a group %s", name.str()));
536536
return nullptr;
537537
}
538538
TransitionGroup *g = NEW TransitionGroup;

Core/GameEngine/Source/GameClient/GUI/LoadScreen.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ void MultiPlayerLoadScreen::processProgress(Int playerId, Int percentage)
14721472

14731473
if( percentage < 0 || percentage > 100 || playerId >= MAX_SLOTS || playerId < 0 || m_playerLookup[playerId] == -1)
14741474
{
1475-
DEBUG_ASSERTCRASH(FALSE, ("Percentage %d was passed in for Player %d", percentage, playerId));
1475+
DEBUG_CRASH(("Percentage %d was passed in for Player %d", percentage, playerId));
14761476
return;
14771477
}
14781478
//DEBUG_LOG(("Percentage %d was passed in for Player %d (in loadscreen position %d)", percentage, playerId, m_playerLookup[playerId]));
@@ -1831,7 +1831,7 @@ void GameSpyLoadScreen::processProgress(Int playerId, Int percentage)
18311831

18321832
if( percentage < 0 || percentage > 100 || playerId >= MAX_SLOTS || playerId < 0 || m_playerLookup[playerId] == -1)
18331833
{
1834-
DEBUG_ASSERTCRASH(FALSE, ("Percentage %d was passed in for Player %d", percentage, playerId));
1834+
DEBUG_CRASH(("Percentage %d was passed in for Player %d", percentage, playerId));
18351835
return;
18361836
}
18371837
//DEBUG_LOG(("Percentage %d was passed in for Player %d (in loadscreen position %d)", percentage, playerId, m_playerLookup[playerId]));
@@ -1969,7 +1969,7 @@ void MapTransferLoadScreen::processProgress(Int playerId, Int percentage, AsciiS
19691969

19701970
if( percentage < 0 || percentage > 100 || playerId >= MAX_SLOTS || playerId < 0 || m_playerLookup[playerId] == -1)
19711971
{
1972-
DEBUG_ASSERTCRASH(FALSE, ("Percentage %d was passed in for Player %d", percentage, playerId));
1972+
DEBUG_CRASH(("Percentage %d was passed in for Player %d", percentage, playerId));
19731973
return;
19741974
}
19751975

Core/GameEngine/Source/GameClient/GameText.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ Bool GameTextManager::parseStringFile( const char *filename )
10371037
{
10381038
if ( stricmp ( m_stringInfo[i].label.str(), m_buffer ) == 0)
10391039
{
1040-
DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' multiply defined!", m_buffer ));
1040+
DEBUG_CRASH ( ("String label '%s' multiply defined!", m_buffer ));
10411041
}
10421042
}
10431043

@@ -1055,7 +1055,7 @@ Bool GameTextManager::parseStringFile( const char *filename )
10551055
{
10561056
if (!readLine ( m_buffer, sizeof(m_buffer)-1, file ))
10571057
{
1058-
DEBUG_ASSERTCRASH (FALSE, ("Unexpected end of string file"));
1058+
DEBUG_CRASH (("Unexpected end of string file"));
10591059
ok = FALSE;
10601060
goto quit;
10611061
}
@@ -1073,7 +1073,7 @@ Bool GameTextManager::parseStringFile( const char *filename )
10731073
if ( readString )
10741074
{
10751075
// only one string per label allows
1076-
DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' has more than one string defined!", m_stringInfo[listCount].label.str()));
1076+
DEBUG_CRASH ( ("String label '%s' has more than one string defined!", m_stringInfo[listCount].label.str()));
10771077
}
10781078
else
10791079
{
@@ -1168,7 +1168,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename )
11681168
{
11691169
if ( stricmp ( m_mapStringInfo[i].label.str(), m_buffer ) == 0)
11701170
{
1171-
DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' multiply defined!", m_buffer ));
1171+
DEBUG_CRASH ( ("String label '%s' multiply defined!", m_buffer ));
11721172
}
11731173
}
11741174

@@ -1186,7 +1186,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename )
11861186
{
11871187
if (!readLine ( m_buffer, sizeof(m_buffer)-1, file ))
11881188
{
1189-
DEBUG_ASSERTCRASH (FALSE, ("Unexpected end of string file"));
1189+
DEBUG_CRASH (("Unexpected end of string file"));
11901190
ok = FALSE;
11911191
goto quit;
11921192
}
@@ -1204,7 +1204,7 @@ Bool GameTextManager::parseMapStringFile( const char *filename )
12041204
if ( readString )
12051205
{
12061206
// only one string per label allowed
1207-
DEBUG_ASSERTCRASH ( FALSE, ("String label '%s' has more than one string defined!", m_stringInfo[listCount].label.str()));
1207+
DEBUG_CRASH ( ("String label '%s' has more than one string defined!", m_stringInfo[listCount].label.str()));
12081208
}
12091209
else
12101210
{

Core/GameEngine/Source/GameClient/GlobalLanguage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void GlobalLanguage::init()
162162
AsciiString font = *it;
163163
if(AddFontResource(font.str()) == 0)
164164
{
165-
DEBUG_ASSERTCRASH(FALSE,("GlobalLanguage::init Failed to add font %s", font.str()));
165+
DEBUG_CRASH(("GlobalLanguage::init Failed to add font %s", font.str()));
166166
}
167167
else
168168
{

Core/GameEngine/Source/GameClient/MapUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,7 @@ Image *getMapPreviewImage( AsciiString mapName )
12561256
// Read the waypoints.
12571257
file.registerParser( "MapPreview", AsciiString::TheEmptyString, parseMapPreviewChunk );
12581258
if (!file.parse(nullptr)) {
1259-
DEBUG_ASSERTCRASH(false,("Unable to read MapPreview info."));
1259+
DEBUG_CRASH(("Unable to read MapPreview info."));
12601260
deleteInstance(mapPreviewImage);
12611261
return nullptr;
12621262
}

Core/GameEngine/Source/GameNetwork/GameInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ AsciiString GameInfoToAsciiString( const GameInfo *game )
978978
}
979979
else
980980
{
981-
DEBUG_ASSERTCRASH(false, ("Bad slot type"));
981+
DEBUG_CRASH(("Bad slot type"));
982982
str = "X:";
983983
}
984984
optionsString.concat(str);

Core/GameEngine/Source/GameNetwork/LANAPI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ AsciiString LANAPI::createSlotString( void )
989989
}
990990
else
991991
{
992-
DEBUG_ASSERTCRASH(false, ("Bad slot type"));
992+
DEBUG_CRASH(("Bad slot type"));
993993
str = "X,";
994994
}
995995
@@ -1153,7 +1153,7 @@ void LANAPI::removeGame( LANGameInfo *game )
11531153
else
11541154
{
11551155
// Odd. We went the whole way without finding it in the list.
1156-
DEBUG_ASSERTCRASH(false, ("LANGameInfo wasn't in the list"));
1156+
DEBUG_CRASH(("LANGameInfo wasn't in the list"));
11571157
}
11581158
}
11591159
}
@@ -1194,7 +1194,7 @@ void LANAPI::removePlayer( LANPlayer *player )
11941194
else
11951195
{
11961196
// Odd. We went the whole way without finding it in the list.
1197-
DEBUG_ASSERTCRASH(false, ("LANPlayer wasn't in the list"));
1197+
DEBUG_CRASH(("LANPlayer wasn't in the list"));
11981198
}
11991199
}
12001200
}

0 commit comments

Comments
 (0)