Skip to content

Commit 353e74a

Browse files
committed
[GEN][ZH] Polish debug logging strings by hand (#1232)
1 parent 9649288 commit 353e74a

File tree

31 files changed

+79
-109
lines changed

31 files changed

+79
-109
lines changed

Core/Tools/Autorun/GameText.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,15 +357,17 @@ void GameTextManager::deinit( void )
357357

358358
NoString *noString = m_noStringList;
359359

360-
DEBUG_LOG(("\n*** Missing strings ***"));
360+
DEBUG_LOG((""));
361+
DEBUG_LOG(("*** Missing strings ***"));
361362
while ( noString )
362363
{
363364
DEBUG_LOG(("*** %ls ***", noString->text.str()));
364365
NoString *next = noString->next;
365366
delete noString;
366367
noString = next;
367368
}
368-
DEBUG_LOG(("*** End missing strings ***\n"));
369+
DEBUG_LOG(("*** End missing strings ***"));
370+
DEBUG_LOG((""));
369371

370372
m_noStringList = NULL;
371373

Core/Tools/Compress/Compress.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ static void DebugLog(const char* format, ...)
3939

4040
void dumpHelp(const char *exe)
4141
{
42-
DEBUG_LOG(("Usage:\n To print the compression type of an existing file: %s -in infile", exe));
43-
DEBUG_LOG((" To compress a file: %s -in infile -out outfile <-type compressionmode>\n", exe));
42+
DEBUG_LOG(("Usage:"));
43+
DEBUG_LOG((" To print the compression type of an existing file: %s -in infile", exe));
44+
DEBUG_LOG((" To compress a file: %s -in infile -out outfile <-type compressionmode>", exe));
45+
DEBUG_LOG((""));
4446
DEBUG_LOG(("Compression modes:"));
4547
for (int i=COMPRESSION_MIN; i<=COMPRESSION_MAX; ++i)
4648
{

Generals/Code/GameEngine/Include/GameClient/LanguageFilter.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ struct UnicodeStringsEqual
5555
Bool operator()(UnicodeString a, UnicodeString b) const
5656
{
5757
Bool retval = (a.compareNoCase(b) == 0);
58-
DEBUG_LOG(("Comparing %ls with %ls, return value is ", a.str(), b.str()));
59-
if (retval) {
60-
DEBUG_LOG(("true."));
61-
} else {
62-
DEBUG_LOG(("false."));
63-
}
58+
DEBUG_LOG(("Comparing %ls with %ls, return value is %s.", a.str(), b.str(), retval ? "true" : "false"));
6459
return retval;
6560
}
6661
};

Generals/Code/GameEngine/Source/Common/PerfTimer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ void PerfTimer::outputInfo( void )
519519
#endif
520520

521521
if (m_crashWithInfo) {
522-
DEBUG_CRASH(("%s"
522+
DEBUG_CRASH(("%s\n"
523523
"Average Time (per call): %.4f ms\n"
524524
"Average Time (per frame): %.4f ms\n"
525525
"Average calls per frame: %.2f\n"
@@ -532,7 +532,7 @@ void PerfTimer::outputInfo( void )
532532
m_callCount,
533533
1000.0f / avgTimePerFrame));
534534
} else {
535-
DEBUG_LOG(("%s"
535+
DEBUG_LOG(("%s\n"
536536
"Average Time (per call): %.4f ms\n"
537537
"Average Time (per frame): %.4f ms\n"
538538
"Average calls per frame: %.2f\n"

Generals/Code/GameEngine/Source/Common/StateMachine.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,7 @@ StateReturnType StateMachine::initDefaultState()
694694
i = m_stateMap.find( curID );
695695

696696
if (i == m_stateMap.end()) {
697-
DEBUG_LOG(("\nState %s(%d) : ", state->getName().str(), id));
698-
DEBUG_LOG(("Transition %d not found", curID));
697+
DEBUG_LOG(("\nState %s(%d) : Transition %d not found", state->getName().str(), id, curID));
699698
DEBUG_LOG(("This MUST BE FIXED!!!jba"));
700699
DEBUG_CRASH(("Invalid transition."));
701700
} else {

Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ const FXList *ThingTemplate::getPerUnitFX(const AsciiString& fxName) const
12901290
PerUnitFXMap::const_iterator it = m_perUnitFX.find(fxName);
12911291
if (it == m_perUnitFX.end())
12921292
{
1293-
DEBUG_CRASH(("Unknown FX name (%s) asked for in ThingTemplate (%s). ", fxName.str(), m_nameString.str()));
1293+
DEBUG_CRASH(("Unknown FX name (%s) asked for in ThingTemplate (%s)", fxName.str(), m_nameString.str()));
12941294
return NULL;
12951295
}
12961296

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5416,7 +5416,7 @@ void InGameUI::showIdleWorkerLayout( void )
54165416
if (!m_idleWorkerWin)
54175417
{
54185418
m_idleWorkerWin = TheWindowManager->winGetWindowFromId(NULL, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker"));
5419-
DEBUG_ASSERTCRASH(m_idleWorkerWin, ("InGameUI::showIdleWorkerLayout could not find IdleWorker.wnd to load "));
5419+
DEBUG_ASSERTCRASH(m_idleWorkerWin, ("InGameUI::showIdleWorkerLayout could not find IdleWorker.wnd to load"));
54205420
return;
54215421
}
54225422

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ Image *getMapPreviewImage( AsciiString mapName )
10611061
{
10621062
if(!TheGlobalData)
10631063
return NULL;
1064-
DEBUG_LOG(("%s Map Name ", mapName.str()));
1064+
DEBUG_LOG(("%s Map Name", mapName.str()));
10651065
AsciiString tgaName = mapName;
10661066
AsciiString name;
10671067
AsciiString tempName;

Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ void PathfindCell::setGoalUnit(ObjectID unitID, const ICoord2D &pos )
13251325
allocateInfo(pos);
13261326
}
13271327
if (!m_info) {
1328-
DEBUG_CRASH(("Ran out of pathfind cells - fatal error!!!!! jba. "));
1328+
DEBUG_CRASH(("Ran out of pathfind cells - fatal error!!!!! jba."));
13291329
return;
13301330
}
13311331
m_info->m_goalUnitID = unitID;
@@ -1361,7 +1361,7 @@ void PathfindCell::setGoalAircraft(ObjectID unitID, const ICoord2D &pos )
13611361
allocateInfo(pos);
13621362
}
13631363
if (!m_info) {
1364-
DEBUG_CRASH(("Ran out of pathfind cells - fatal error!!!!! jba. "));
1364+
DEBUG_CRASH(("Ran out of pathfind cells - fatal error!!!!! jba."));
13651365
return;
13661366
}
13671367
m_info->m_goalAircraftID = unitID;
@@ -1397,7 +1397,7 @@ void PathfindCell::setPosUnit(ObjectID unitID, const ICoord2D &pos )
13971397
allocateInfo(pos);
13981398
}
13991399
if (!m_info) {
1400-
DEBUG_CRASH(("Ran out of pathfind cells - fatal error!!!!! jba. "));
1400+
DEBUG_CRASH(("Ran out of pathfind cells - fatal error!!!!! jba."));
14011401
return;
14021402
}
14031403
if (m_info->m_goalUnitID!=INVALID_ID && (m_info->m_goalUnitID==m_info->m_posUnitID)) {
@@ -5157,7 +5157,7 @@ Bool Pathfinder::queueForPath(ObjectID id)
51575157
AIUpdateInterface *tmpAI = tmpObj->getAIUpdateInterface();
51585158
if (tmpAI) {
51595159
const Coord3D* pos = tmpAI->friend_getRequestedDestination();
5160-
DEBUG_ASSERTLOG(pos->x != 0.0 && pos->y != 0.0, ("Queueing pathfind to (0, 0), usually a bug. (Unit Name: '%s', Type: '%s' ", tmpObj->getName().str(), tmpObj->getTemplate()->getName().str()));
5160+
DEBUG_ASSERTLOG(pos->x != 0.0 && pos->y != 0.0, ("Queueing pathfind to (0, 0), usually a bug. (Unit Name: '%s', Type: '%s')", tmpObj->getName().str(), tmpObj->getTemplate()->getName().str()));
51615161
}
51625162
}
51635163
}
@@ -5433,9 +5433,8 @@ void Pathfinder::processPathfindQueue(void)
54335433
timeToUpdate = ((double)(endTime64-startTime64) / (double)(freq64));
54345434
if (timeToUpdate>0.01f)
54355435
{
5436-
DEBUG_LOG(("%d Pathfind queue: %d paths, %d cells", TheGameLogic->getFrame(), pathsFound, m_cumulativeCellsAllocated));
5437-
DEBUG_LOG(("Time %f (%f)", timeToUpdate, (::GetTickCount()-startTimeMS)/1000.0f));
5438-
DEBUG_LOG((""));
5436+
DEBUG_LOG(("%d Pathfind queue: %d paths, %d cells --", TheGameLogic->getFrame(), pathsFound, m_cumulativeCellsAllocated));
5437+
DEBUG_LOG(("time %f (%f)", timeToUpdate, (::GetTickCount()-startTimeMS)/1000.0f));
54395438
}
54405439
#endif
54415440
#endif
@@ -6192,8 +6191,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe
61926191
Bool valid;
61936192
valid = validMovementPosition( isCrusher, obj->getLayer(), locomotorSet, to ) ;
61946193

6195-
DEBUG_LOG(("%d ", TheGameLogic->getFrame()));
6196-
DEBUG_LOG(("Pathfind failed from (%f,%f) to (%f,%f), OV %d", from->x, from->y, to->x, to->y, valid));
6194+
DEBUG_LOG(("%d Pathfind failed from (%f,%f) to (%f,%f), OV %d --", TheGameLogic->getFrame(), from->x, from->y, to->x, to->y, valid));
61976195
DEBUG_LOG(("Unit '%s', time %f, cells %d", obj->getTemplate()->getName().str(), (::GetTickCount()-startTimeMS)/1000.0f,cellCount));
61986196
}
61996197
#endif
@@ -6810,8 +6808,7 @@ Path *Pathfinder::findGroundPath( const Coord3D *from,
68106808
}
68116809
#endif
68126810

6813-
DEBUG_LOG(("%d ", TheGameLogic->getFrame()));
6814-
DEBUG_LOG(("FindGroundPath failed from (%f,%f) to (%f,%f)", from->x, from->y, to->x, to->y));
6811+
DEBUG_LOG(("%d FindGroundPath failed from (%f,%f) to (%f,%f) --", TheGameLogic->getFrame(), from->x, from->y, to->x, to->y));
68156812
DEBUG_LOG(("time %f", (::GetTickCount()-startTimeMS)/1000.0f));
68166813

68176814
#ifdef DUMP_PERF_STATS
@@ -7426,8 +7423,7 @@ Path *Pathfinder::internal_findHierarchicalPath( Bool isHuman, const LocomotorSu
74267423
}
74277424
#endif
74287425

7429-
DEBUG_LOG(("%d ", TheGameLogic->getFrame()));
7430-
DEBUG_LOG(("FindHierarchicalPath failed from (%f,%f) to (%f,%f)", from->x, from->y, to->x, to->y));
7426+
DEBUG_LOG(("%d FindHierarchicalPath failed from (%f,%f) to (%f,%f) --", TheGameLogic->getFrame(), from->x, from->y, to->x, to->y));
74317427
DEBUG_LOG(("time %f", (::GetTickCount()-startTimeMS)/1000.0f));
74327428

74337429
#ifdef DUMP_PERF_STATS
@@ -8321,8 +8317,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
83218317
}
83228318
#endif
83238319

8324-
DEBUG_LOG(("%d ", TheGameLogic->getFrame()));
8325-
DEBUG_LOG(("Pathfind(findClosestPath) chugged from (%f,%f) to (%f,%f), --", from->x, from->y, to->x, to->y));
8320+
DEBUG_LOG(("%d Pathfind(findClosestPath) chugged from (%f,%f) to (%f,%f) --", TheGameLogic->getFrame(), from->x, from->y, to->x, to->y));
83268321
DEBUG_LOG(("Unit '%s', time %f", obj->getTemplate()->getName().str(), (::GetTickCount()-startTimeMS)/1000.0f));
83278322
#ifdef INTENSE_DEBUG
83288323
TheScriptEngine->AppendDebugMessage("Big path FCP CC", false);
@@ -8347,8 +8342,7 @@ Path *Pathfinder::findClosestPath( Object *obj, const LocomotorSet& locomotorSet
83478342
Bool valid;
83488343
valid = validMovementPosition( isCrusher, obj->getLayer(), locomotorSet, to ) ;
83498344

8350-
DEBUG_LOG(("%d ", TheGameLogic->getFrame()));
8351-
DEBUG_LOG(("Pathfind(findClosestPath) failed from (%f,%f) to (%f,%f), original valid %d --", from->x, from->y, to->x, to->y, valid));
8345+
DEBUG_LOG(("Pathfind(findClosestPath) failed from (%f,%f) to (%f,%f), original valid %d --", TheGameLogic->getFrame(), from->x, from->y, to->x, to->y, valid));
83528346
DEBUG_LOG(("Unit '%s', time %f", obj->getTemplate()->getName().str(), (::GetTickCount()-startTimeMS)/1000.0f));
83538347
#endif
83548348
#if defined(RTS_DEBUG)
@@ -9741,8 +9735,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj,
97419735
debugShowSearch(true);
97429736
#endif
97439737

9744-
DEBUG_LOG(("%d ", TheGameLogic->getFrame()));
9745-
DEBUG_LOG(("getMoveAwayFromPath pathfind failed -- "));
9738+
DEBUG_LOG(("%d getMoveAwayFromPath pathfind failed --", TheGameLogic->getFrame()));
97469739
DEBUG_LOG(("Unit '%s', time %f", obj->getTemplate()->getName().str(), (::GetTickCount()-startTimeMS)/1000.0f));
97479740

97489741
m_isTunneling = false;
@@ -9920,8 +9913,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet
99209913
}
99219914
}
99229915

9923-
DEBUG_LOG(("%d ", TheGameLogic->getFrame()));
9924-
DEBUG_LOG(("patchPath Pathfind failed -- "));
9916+
DEBUG_LOG(("%d patchPath Pathfind failed --", TheGameLogic->getFrame()));
99259917
DEBUG_LOG(("Unit '%s', time %f", obj->getTemplate()->getName().str(), (::GetTickCount()-startTimeMS)/1000.0f));
99269918

99279919
#if defined(RTS_DEBUG)
@@ -10221,8 +10213,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
1022110213
return path;
1022210214
}
1022310215
#if defined(RTS_DEBUG)
10224-
DEBUG_LOG(("%d (%d cells)", TheGameLogic->getFrame(), cellCount));
10225-
DEBUG_LOG(("Attack Pathfind failed from (%f,%f) to (%f,%f) -- ", from->x, from->y, victim->getPosition()->x, victim->getPosition()->y));
10216+
DEBUG_LOG(("%d (%d cells) Attack Pathfind failed from (%f,%f) to (%f,%f) --", TheGameLogic->getFrame(), cellCount, from->x, from->y, victim->getPosition()->x, victim->getPosition()->y));
1022610217
DEBUG_LOG(("Unit '%s', attacking '%s' time %f", obj->getTemplate()->getName().str(), victim->getTemplate()->getName().str(), (::GetTickCount()-startTimeMS)/1000.0f));
1022710218
#endif
1022810219
#endif
@@ -10382,8 +10373,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor
1038210373
#endif
1038310374
#if 0
1038410375
#if defined(RTS_DEBUG)
10385-
DEBUG_LOG(("%d (%d cells)", TheGameLogic->getFrame(), cellCount));
10386-
DEBUG_LOG(("Attack Pathfind failed from (%f,%f) to (%f,%f) -- ", from->x, from->y, victim->getPosition()->x, victim->getPosition()->y));
10376+
DEBUG_LOG(("%d (%d cells) Attack Pathfind failed from (%f,%f) to (%f,%f) --", TheGameLogic->getFrame(), cellCount, from->x, from->y, victim->getPosition()->x, victim->getPosition()->y));
1038710377
DEBUG_LOG(("Unit '%s', attacking '%s' time %f", obj->getTemplate()->getName().str(), victim->getTemplate()->getName().str(), (::GetTickCount()-startTimeMS)/1000.0f));
1038810378
#endif
1038910379
#endif

Generals/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ UnsignedInt WeaponTemplate::fireWeaponTemplate
740740
else
741741
targetStr.format( "SELF." );
742742

743-
DEBUG_LOG( ("%d - WeaponTemplate::fireWeaponTemplate() begin - %s attacking %s - ",
743+
DEBUG_LOG( ("%d - WeaponTemplate::fireWeaponTemplate() begin - %s attacking %s",
744744
TheGameLogic->getFrame(), sourceObj->getTemplate()->getName().str(), targetStr.str() ) );
745745
}
746746
#endif

0 commit comments

Comments
 (0)