From 87c269bfe9170357982ff23b085d070b0217215e Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Mon, 21 Apr 2025 15:05:20 +0200 Subject: [PATCH 01/22] Fix mismatch in release+logging build when AI player is involved --- .../GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 53f33d2f1b..c03041416a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -681,12 +681,16 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); - DEBUG_LOG(("buildAIBaseDefenseStructure -- Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); +#if defined(_DEBUG) || defined(_INTERNAL) + // TheSuperHackers @info helmutbuhler 04/21/2025 + // This log causes mismatch on Release when logging is enabled. + DEBUG_LOG(("buildAIBaseDefenseStructure -- Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("buildAIBaseDefenseStructure -- Offset is %f %f, Final Position is %f, %f \n", offset.x, offset.y, offset.x*c - offset.y*s, offset.y*c + offset.x*s - )); + )); +#endif Coord3D buildPos = m_baseCenter; buildPos.x += offset.x*c - offset.y*s; buildPos.y += offset.y*c + offset.x*s; From d520d2862d4acd7d36e541eaee45df9a009a5d66 Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Mon, 21 Apr 2025 15:56:46 +0200 Subject: [PATCH 02/22] Gen: Fix mismatch in release+logging build when AI player is involved --- .../GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index df556f9bfa..ae6c335fe9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -672,12 +672,16 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); - DEBUG_LOG(("Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); +#if defined(_DEBUG) || defined(_INTERNAL) + // TheSuperHackers @info helmutbuhler 04/21/2025 + // This log causes mismatch on Release when logging is enabled. + DEBUG_LOG(("Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("Offset is %f %f, new is %f, %f \n", offset.x, offset.y, offset.x*c - offset.y*s, offset.y*c + offset.x*s - )); + )); +#endif Coord3D buildPos = m_baseCenter; buildPos.x += offset.x*c - offset.y*s; buildPos.y += offset.y*c + offset.x*s; From 22fb160d0078d09a5a1ceedba3976da6e3b733aa Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Mon, 21 Apr 2025 17:25:19 +0200 Subject: [PATCH 03/22] Fix date in comments --- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index ae6c335fe9..f1bac28cb7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -673,7 +673,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real c = cos(angle); #if defined(_DEBUG) || defined(_INTERNAL) - // TheSuperHackers @info helmutbuhler 04/21/2025 + // TheSuperHackers @info helmutbuhler 21/04/2025 // This log causes mismatch on Release when logging is enabled. DEBUG_LOG(("Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("Offset is %f %f, new is %f, %f \n", diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index c03041416a..9358d5f2e0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -682,7 +682,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real c = cos(angle); #if defined(_DEBUG) || defined(_INTERNAL) - // TheSuperHackers @info helmutbuhler 04/21/2025 + // TheSuperHackers @info helmutbuhler 21/04/2025 // This log causes mismatch on Release when logging is enabled. DEBUG_LOG(("buildAIBaseDefenseStructure -- Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("buildAIBaseDefenseStructure -- Offset is %f %f, Final Position is %f, %f \n", From 643123bd8b8338e31ac4540658d804d707ad9c2e Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Sat, 26 Apr 2025 12:01:30 +0200 Subject: [PATCH 04/22] ZH: Fix logs that mismatch on Release in StateMachine --- .../Code/GameEngine/Source/Common/StateMachine.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index cf79a8f029..9dd1f08f01 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -518,15 +518,19 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { + // TheSuperHackers @info helmutbuhler 26/04/2025 + // These logs cause mismatch on Release when logging is enabled. DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); - DEBUG_LOG(("Transisioning to state #d\n", (Int)id)); +#if defined(_DEBUG) || defined(_INTERNAL) + DEBUG_LOG(("Transitioning to state #d\n", (Int)id)); DEBUG_LOG(("Attempting to recover - locating default state...\n")); +#endif i = m_stateMap.find(m_defaultStateID); if (i == m_stateMap.end()) { +#if defined(_DEBUG) || defined(_INTERNAL) DEBUG_LOG(("Failed to located default state. Aborting...\n")); +#endif throw ERROR_BAD_ARG; - } else { - DEBUG_LOG(("Located default state to recover.\n")); } } From 559e701ea19197c8f51971ddc10a69095d0c48fb Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Sat, 26 Apr 2025 12:08:09 +0200 Subject: [PATCH 05/22] Gen: Fix logs that mismatch on Release in StateMachine --- .../GameEngine/Source/Common/StateMachine.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index f8df862b8c..cd73176dca 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -499,8 +499,20 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { - DEBUG_CRASH(( "StateMachine::internalGetState(): Invalid state" )); - throw ERROR_BAD_ARG; + // TheSuperHackers @info helmutbuhler 26/04/2025 + // These logs cause mismatch on Release when logging is enabled. + DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); +#if defined(_DEBUG) || defined(_INTERNAL) + DEBUG_LOG(("Transitioning to state #d\n", (Int)id)); + DEBUG_LOG(("Attempting to recover - locating default state...\n")); +#endif + i = m_stateMap.find(m_defaultStateID); + if (i == m_stateMap.end()) { +#if defined(_DEBUG) || defined(_INTERNAL) + DEBUG_LOG(("Failed to located default state. Aborting...\n")); +#endif + throw ERROR_BAD_ARG; + } } return (*i).second; From f83ec496143495b8dabc4ed532b6e376d040da82 Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Mon, 5 May 2025 11:52:45 +0200 Subject: [PATCH 06/22] ZH Gen: Fix crash when version is logged in debug build and replay version contains non-ascii characters --- Generals/Code/GameEngine/Source/Common/Recorder.cpp | 5 ++++- GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index e7e2c12f0c..1bd11941e3 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -1112,7 +1112,10 @@ Bool RecorderClass::playbackFile(AsciiString filename) debugString = "EXE is different:\n"; if (versionStringDiff) { - tempStr.format(" Version [%ls] vs [%ls]\n", TheVersion->getUnicodeVersion().str(), header.versionString.str()); + // AsciiString::format with %ls can make internal _vsnprintf call fail on some strings. We convert using translate here. (TheSuperHackers @fix helmutbuhler 05/05/2025) + UnicodeString tempStrWide; + tempStrWide.format(L" Version [%s] vs [%s]\n", TheVersion->getUnicodeVersion().str(), header.versionString.str()); + tempStr.translate(tempStrWide); debugString.concat(tempStr); } if (versionTimeStringDiff) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index 46ebcaa78e..626d2823b4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -1115,7 +1115,10 @@ Bool RecorderClass::playbackFile(AsciiString filename) debugString = "EXE is different:\n"; if (versionStringDiff) { - tempStr.format(" Version [%ls] vs [%ls]\n", TheVersion->getUnicodeVersion().str(), header.versionString.str()); + // AsciiString::format with %ls can make internal _vsnprintf call fail on some strings. We convert using translate here. (TheSuperHackers @fix helmutbuhler 05/05/2025) + UnicodeString tempStrWide; + tempStrWide.format(L" Version [%s] vs [%s]\n", TheVersion->getUnicodeVersion().str(), header.versionString.str()); + tempStr.translate(tempStrWide); debugString.concat(tempStr); } if (versionTimeStringDiff) From 17fca13d04e2bc03723a41660fb9bc866be51701 Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Mon, 5 May 2025 11:58:40 +0200 Subject: [PATCH 07/22] GEN ZH Remove Debug condition on DEBUG_LOGs in StateMachine. They are not necessary afterall. --- Generals/Code/GameEngine/Source/Common/StateMachine.cpp | 6 ------ GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp | 6 ------ 2 files changed, 12 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index cd73176dca..ab226102bd 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -499,18 +499,12 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { - // TheSuperHackers @info helmutbuhler 26/04/2025 - // These logs cause mismatch on Release when logging is enabled. DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); -#if defined(_DEBUG) || defined(_INTERNAL) DEBUG_LOG(("Transitioning to state #d\n", (Int)id)); DEBUG_LOG(("Attempting to recover - locating default state...\n")); -#endif i = m_stateMap.find(m_defaultStateID); if (i == m_stateMap.end()) { -#if defined(_DEBUG) || defined(_INTERNAL) DEBUG_LOG(("Failed to located default state. Aborting...\n")); -#endif throw ERROR_BAD_ARG; } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index 9dd1f08f01..55724954c4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -518,18 +518,12 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { - // TheSuperHackers @info helmutbuhler 26/04/2025 - // These logs cause mismatch on Release when logging is enabled. DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); -#if defined(_DEBUG) || defined(_INTERNAL) DEBUG_LOG(("Transitioning to state #d\n", (Int)id)); DEBUG_LOG(("Attempting to recover - locating default state...\n")); -#endif i = m_stateMap.find(m_defaultStateID); if (i == m_stateMap.end()) { -#if defined(_DEBUG) || defined(_INTERNAL) DEBUG_LOG(("Failed to located default state. Aborting...\n")); -#endif throw ERROR_BAD_ARG; } } From b10df8e6a10b855f74ad3aea0e9bcec34f9c5451 Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Mon, 5 May 2025 12:01:22 +0200 Subject: [PATCH 08/22] GEN ZH: Fix format #d -> %d --- Generals/Code/GameEngine/Source/Common/StateMachine.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index ab226102bd..f3cc44161f 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -500,7 +500,7 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); - DEBUG_LOG(("Transitioning to state #d\n", (Int)id)); + DEBUG_LOG(("Transitioning to state %d\n", (Int)id)); DEBUG_LOG(("Attempting to recover - locating default state...\n")); i = m_stateMap.find(m_defaultStateID); if (i == m_stateMap.end()) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index 55724954c4..dd2c2ff5b0 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -519,7 +519,7 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); - DEBUG_LOG(("Transitioning to state #d\n", (Int)id)); + DEBUG_LOG(("Transitioning to state %d\n", (Int)id)); DEBUG_LOG(("Attempting to recover - locating default state...\n")); i = m_stateMap.find(m_defaultStateID); if (i == m_stateMap.end()) { From e05e1b2bb912c4cffb3eb2718de025a174f42078 Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Mon, 5 May 2025 14:00:37 +0200 Subject: [PATCH 09/22] Fix another mismatch due to logging --- GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 5bd89527fa..6fc12f6e10 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4149,8 +4149,11 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { + // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) +#if defined(_DEBUG) || defined(_INTERNAL) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); +#endif } return STATE_FAILURE; } @@ -4219,8 +4222,11 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { + // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) +#if defined(_DEBUG) || defined(_INTERNAL) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); +#endif } return STATE_FAILURE; } From b0a340d425bd5c582790fff51858d9b8782c7917 Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Mon, 5 May 2025 23:01:47 +0200 Subject: [PATCH 10/22] Fix yet another mm in Release. This time when DEBUG_CRASHING is enabled --- .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 4b69792e68..bd97a0c0a2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -94,7 +94,11 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { +#if defined(_DEBUG) || defined(_INTERNAL) + // TheSuperHackers @info helmutbuhler 05/05/2025 + // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); +#endif // sanity if( targetPos == NULL || m_garrisonPointsInUse == MAX_GARRISON_POINTS ) From 153adceda8d6d63aea312f39cd37668d38745faf Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Tue, 6 May 2025 01:38:11 +0200 Subject: [PATCH 11/22] Fix another mm when DEBUG_CRASHING is defined --- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 343a23aee9..3156e1e329 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -321,7 +321,11 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { +#if defined(_DEBUG) || defined(_INTERNAL) + // TheSuperHackers @info helmutbuhler 06/05/2025 + // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); +#endif if (_isnan(force->x) || _isnan(force->y) || _isnan(force->z)) { return; } From b9db1d46b11d9dcf1017f66e1efe99b3ad1dc60e Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Tue, 6 May 2025 09:51:17 +0200 Subject: [PATCH 12/22] Sync with Generals --- Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 6 ++++++ .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 4 ++++ .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 3d81a08c52..580a8b5ff5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -3984,8 +3984,11 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { + // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) +#if defined(_DEBUG) || defined(_INTERNAL) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); +#endif } return STATE_FAILURE; } @@ -4054,8 +4057,11 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { + // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) +#if defined(_DEBUG) || defined(_INTERNAL) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); +#endif } return STATE_FAILURE; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 626230a42f..979e554964 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -93,7 +93,11 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { +#if defined(_DEBUG) || defined(_INTERNAL) + // TheSuperHackers @info helmutbuhler 05/05/2025 + // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); +#endif // sanity if( targetPos == NULL || m_garrisonPointsInUse == MAX_GARRISON_POINTS ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 7b59b43f0e..f2359b320b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -303,7 +303,11 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { +#if defined(_DEBUG) || defined(_INTERNAL) + // TheSuperHackers @info helmutbuhler 06/05/2025 + // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); +#endif if (_isnan(force->x) || _isnan(force->y) || _isnan(force->z)) { return; } From 578bb75fd09ee8a927915c12c2d581b63ab429a5 Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Tue, 6 May 2025 09:59:07 +0200 Subject: [PATCH 13/22] Rename defines to RTS_DEBUG and RTS_INTERNAL --- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 4 ++-- .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 2 +- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 4 ++-- .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 2 +- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index dec95f66b0..65fdc03836 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -672,7 +672,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) // TheSuperHackers @info helmutbuhler 21/04/2025 // This log causes mismatch on Release when logging is enabled. DEBUG_LOG(("Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 03bff2387d..caac762aea 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4029,7 +4029,7 @@ StateReturnType AIFollowWaypointPathState::update() if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif @@ -4102,7 +4102,7 @@ StateReturnType AIFollowWaypointPathState::update() if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 9ae0d0a615..e04cec1dd1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -93,7 +93,7 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) // TheSuperHackers @info helmutbuhler 05/05/2025 // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index e95371a213..9fc0ddaf85 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -303,7 +303,7 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) // TheSuperHackers @info helmutbuhler 06/05/2025 // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index a8ca09d8e6..3b8c19fa88 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -681,7 +681,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) // TheSuperHackers @info helmutbuhler 21/04/2025 // This log causes mismatch on Release when logging is enabled. DEBUG_LOG(("buildAIBaseDefenseStructure -- Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index fdb36ec1eb..648c0dc2d0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4150,7 +4150,7 @@ StateReturnType AIFollowWaypointPathState::update() if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif @@ -4223,7 +4223,7 @@ StateReturnType AIFollowWaypointPathState::update() if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 7066d16e4a..2df6a64357 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -94,7 +94,7 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) // TheSuperHackers @info helmutbuhler 05/05/2025 // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 358016c285..ca9dcbda8c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -321,7 +321,7 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) // TheSuperHackers @info helmutbuhler 06/05/2025 // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); From fc0ba7d396eb0eec9f47d738461020f339d4b81e Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Tue, 6 May 2025 20:32:40 +0200 Subject: [PATCH 14/22] Remove Unicode fix in RecorderClass::playbackFile --- Generals/Code/GameEngine/Source/Common/Recorder.cpp | 5 +---- GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index 66ac615c1e..497aa71bfb 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -1115,10 +1115,7 @@ Bool RecorderClass::playbackFile(AsciiString filename) debugString = "EXE is different:\n"; if (versionStringDiff) { - // AsciiString::format with %ls can make internal _vsnprintf call fail on some strings. We convert using translate here. (TheSuperHackers @fix helmutbuhler 05/05/2025) - UnicodeString tempStrWide; - tempStrWide.format(L" Version [%s] vs [%s]\n", TheVersion->getUnicodeVersion().str(), header.versionString.str()); - tempStr.translate(tempStrWide); + tempStr.format(" Version [%ls] vs [%ls]\n", TheVersion->getUnicodeVersion().str(), header.versionString.str()); debugString.concat(tempStr); } if (versionTimeStringDiff) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp index d853df9421..bccc2c2add 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Recorder.cpp @@ -1118,10 +1118,7 @@ Bool RecorderClass::playbackFile(AsciiString filename) debugString = "EXE is different:\n"; if (versionStringDiff) { - // AsciiString::format with %ls can make internal _vsnprintf call fail on some strings. We convert using translate here. (TheSuperHackers @fix helmutbuhler 05/05/2025) - UnicodeString tempStrWide; - tempStrWide.format(L" Version [%s] vs [%s]\n", TheVersion->getUnicodeVersion().str(), header.versionString.str()); - tempStr.translate(tempStrWide); + tempStr.format(" Version [%ls] vs [%ls]\n", TheVersion->getUnicodeVersion().str(), header.versionString.str()); debugString.concat(tempStr); } if (versionTimeStringDiff) From 5b6be6037d2b5e29bc65f073c360e3eb01307176 Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Tue, 6 May 2025 20:34:18 +0200 Subject: [PATCH 15/22] Add stupid else-block back --- Generals/Code/GameEngine/Source/Common/StateMachine.cpp | 2 ++ GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index 96e309a7c8..f5a83d1f69 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -506,6 +506,8 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { DEBUG_LOG(("Failed to located default state. Aborting...\n")); throw ERROR_BAD_ARG; + } else { + DEBUG_LOG(("Located default state to recover.\n")); } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index 4158015826..b9a5b1dff2 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -525,6 +525,8 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { DEBUG_LOG(("Failed to located default state. Aborting...\n")); throw ERROR_BAD_ARG; + } else { + DEBUG_LOG(("Located default state to recover.\n")); } } From 78c811de561ef78f4737f27b75d7fa1167f4f67a Mon Sep 17 00:00:00 2001 From: Helmut Buhler Date: Mon, 16 Jun 2025 21:05:31 +0200 Subject: [PATCH 16/22] Move comments --- Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 4 ++-- GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 3137d0a2d3..73e4c2c3be 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4028,8 +4028,8 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { - // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) #if defined(RTS_DEBUG) || defined(RTS_INTERNAL) + // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif @@ -4101,8 +4101,8 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { - // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) #if defined(RTS_DEBUG) || defined(RTS_INTERNAL) + // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 496ec5b7ab..1135396a25 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4149,8 +4149,8 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { - // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) #if defined(RTS_DEBUG) || defined(RTS_INTERNAL) + // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif @@ -4222,8 +4222,8 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { - // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) #if defined(RTS_DEBUG) || defined(RTS_INTERNAL) + // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif From 12df09a88f349bd3d53a910441584023747e62d0 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 26 Jun 2025 18:45:05 +0200 Subject: [PATCH 17/22] Simplify comments and do not compile out with !RETAIL_COMPATIBLE_CRC --- .../GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 5 ++--- Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 8 ++++---- .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 5 ++--- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 5 ++--- .../GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 5 ++--- .../Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 8 ++++---- .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 5 ++--- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 5 ++--- 8 files changed, 20 insertions(+), 26 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index d7e78b3139..17c8454a0c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -672,9 +672,8 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // TheSuperHackers @info helmutbuhler 21/04/2025 - // This log causes mismatch on Release when logging is enabled. +// TheSuperHackers @info helmutbuhler 21/04/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("Offset is %f %f, new is %f, %f \n", offset.x, offset.y, diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 73e4c2c3be..2c6619a900 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4028,8 +4028,8 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif @@ -4101,8 +4101,8 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index e04cec1dd1..9d52b95050 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -93,9 +93,8 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // TheSuperHackers @info helmutbuhler 05/05/2025 - // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index aacebb4f10..906eae187b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -303,9 +303,8 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // TheSuperHackers @info helmutbuhler 06/05/2025 - // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. +// TheSuperHackers @info helmutbuhler 06/05/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); #endif if (_isnan(force->x) || _isnan(force->y) || _isnan(force->z)) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index c8221563f2..858b7a3c91 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -681,9 +681,8 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // TheSuperHackers @info helmutbuhler 21/04/2025 - // This log causes mismatch on Release when logging is enabled. +// TheSuperHackers @info helmutbuhler 21/04/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("buildAIBaseDefenseStructure -- Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("buildAIBaseDefenseStructure -- Offset is %f %f, Final Position is %f, %f \n", offset.x, offset.y, diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 1135396a25..a2f7e89daf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4149,8 +4149,8 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif @@ -4222,8 +4222,8 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // This log causes mismatch on Release (TheSuperHackers @info helmutbuhler 05/05/2025) +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 2df6a64357..0cea51d9ff 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -94,9 +94,8 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // TheSuperHackers @info helmutbuhler 05/05/2025 - // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 8d758f5547..21a628d3ba 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -321,9 +321,8 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { -#if defined(RTS_DEBUG) || defined(RTS_INTERNAL) - // TheSuperHackers @info helmutbuhler 06/05/2025 - // This assert causes a mismatch on Release when DEBUG_CRASHING is enabled. +// TheSuperHackers @info helmutbuhler 06/05/2025 This debug transforms the code to become not CRC compatible +#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); #endif if (_isnan(force->x) || _isnan(force->y) || _isnan(force->z)) { From 91d8a279d3edc38f64d7b339586235aa594f278b Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 26 Jun 2025 18:51:15 +0200 Subject: [PATCH 18/22] Revert unrelated changes in StateMachine --- .../Code/GameEngine/Source/Common/StateMachine.cpp | 2 +- .../Code/GameEngine/Source/Common/StateMachine.cpp | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index c5230d02f3..9a674efb25 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -527,7 +527,7 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); - DEBUG_LOG(("Transitioning to state %d\n", (Int)id)); + DEBUG_LOG(("Transisioning to state #d\n", (Int)id)); DEBUG_LOG(("Attempting to recover - locating default state...\n")); i = m_stateMap.find(m_defaultStateID); if (i == m_stateMap.end()) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index 8bc7e89756..9b6d188f71 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -526,16 +526,8 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { - DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); - DEBUG_LOG(("Transitioning to state %d\n", (Int)id)); - DEBUG_LOG(("Attempting to recover - locating default state...\n")); - i = m_stateMap.find(m_defaultStateID); - if (i == m_stateMap.end()) { - DEBUG_LOG(("Failed to located default state. Aborting...\n")); - throw ERROR_BAD_ARG; - } else { - DEBUG_LOG(("Located default state to recover.\n")); - } + DEBUG_CRASH(( "StateMachine::internalGetState(): Invalid state" )); + throw ERROR_BAD_ARG; } return (*i).second; From f60fbda972a15e912d33e3e7acbf43f6f727dccb Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 26 Jun 2025 18:52:15 +0200 Subject: [PATCH 19/22] Revert "Revert unrelated changes in StateMachine" This reverts commit 91d8a279d3edc38f64d7b339586235aa594f278b. --- .../Code/GameEngine/Source/Common/StateMachine.cpp | 2 +- .../Code/GameEngine/Source/Common/StateMachine.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index 9a674efb25..c5230d02f3 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -527,7 +527,7 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); - DEBUG_LOG(("Transisioning to state #d\n", (Int)id)); + DEBUG_LOG(("Transitioning to state %d\n", (Int)id)); DEBUG_LOG(("Attempting to recover - locating default state...\n")); i = m_stateMap.find(m_defaultStateID); if (i == m_stateMap.end()) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index 9b6d188f71..8bc7e89756 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -526,8 +526,16 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { - DEBUG_CRASH(( "StateMachine::internalGetState(): Invalid state" )); - throw ERROR_BAD_ARG; + DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); + DEBUG_LOG(("Transitioning to state %d\n", (Int)id)); + DEBUG_LOG(("Attempting to recover - locating default state...\n")); + i = m_stateMap.find(m_defaultStateID); + if (i == m_stateMap.end()) { + DEBUG_LOG(("Failed to located default state. Aborting...\n")); + throw ERROR_BAD_ARG; + } else { + DEBUG_LOG(("Located default state to recover.\n")); + } } return (*i).second; From 26773d59e3f222968e87be090bd9b3bbbf5270e5 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 26 Jun 2025 18:52:58 +0200 Subject: [PATCH 20/22] Revert unrelated changes in StateMachine 2 --- .../Code/GameEngine/Source/Common/StateMachine.cpp | 12 ++---------- .../Code/GameEngine/Source/Common/StateMachine.cpp | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index c5230d02f3..71f4fea7a0 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -526,16 +526,8 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { - DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); - DEBUG_LOG(("Transitioning to state %d\n", (Int)id)); - DEBUG_LOG(("Attempting to recover - locating default state...\n")); - i = m_stateMap.find(m_defaultStateID); - if (i == m_stateMap.end()) { - DEBUG_LOG(("Failed to located default state. Aborting...\n")); - throw ERROR_BAD_ARG; - } else { - DEBUG_LOG(("Located default state to recover.\n")); - } + DEBUG_CRASH(( "StateMachine::internalGetState(): Invalid state" )); + throw ERROR_BAD_ARG; } return (*i).second; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index 8bc7e89756..7c4de27d48 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -527,7 +527,7 @@ State *StateMachine::internalGetState( StateID id ) if (i == m_stateMap.end()) { DEBUG_CRASH( ("StateMachine::internalGetState(): Invalid state for object %s using state %d", m_owner->getTemplate()->getName().str(), id) ); - DEBUG_LOG(("Transitioning to state %d\n", (Int)id)); + DEBUG_LOG(("Transisioning to state #d\n", (Int)id)); DEBUG_LOG(("Attempting to recover - locating default state...\n")); i = m_stateMap.find(m_defaultStateID); if (i == m_stateMap.end()) { From 977a977e639c08f6595979841f80ec4850d48503 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 26 Jun 2025 18:54:10 +0200 Subject: [PATCH 21/22] Optimize comment wording --- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 4 ++-- .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 2 +- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 4 ++-- .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 2 +- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 17c8454a0c..f7a9d9e0fa 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -672,7 +672,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); -// TheSuperHackers @info helmutbuhler 21/04/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 21/04/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("Offset is %f %f, new is %f, %f \n", diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 2c6619a900..75ef7fdf5a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4028,7 +4028,7 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); @@ -4101,7 +4101,7 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 9d52b95050..f83b4ad361 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -93,7 +93,7 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 906eae187b..15f81e1a2f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -303,7 +303,7 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { -// TheSuperHackers @info helmutbuhler 06/05/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 06/05/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 858b7a3c91..bf7673e5db 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -681,7 +681,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); -// TheSuperHackers @info helmutbuhler 21/04/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 21/04/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("buildAIBaseDefenseStructure -- Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("buildAIBaseDefenseStructure -- Offset is %f %f, Final Position is %f, %f \n", diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index a2f7e89daf..2dbef939d4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4149,7 +4149,7 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); @@ -4222,7 +4222,7 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 0cea51d9ff..7601070a0c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -94,7 +94,7 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 21a628d3ba..ac3ed05f18 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -321,7 +321,7 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { -// TheSuperHackers @info helmutbuhler 06/05/2025 This debug transforms the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 06/05/2025 This debug mutates the code to become not CRC compatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); #endif From 4b6f9e1a7bdc0446b05898c93b31b9496e968b21 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Thu, 26 Jun 2025 18:55:08 +0200 Subject: [PATCH 22/22] Optimize comment wording 2 --- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 4 ++-- .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 2 +- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 4 ++-- .../Source/GameLogic/Object/Contain/GarrisonContain.cpp | 2 +- .../Source/GameLogic/Object/Update/PhysicsUpdate.cpp | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index f7a9d9e0fa..6861406488 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -672,7 +672,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); -// TheSuperHackers @info helmutbuhler 21/04/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 21/04/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("Offset is %f %f, new is %f, %f \n", diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 75ef7fdf5a..44ff76181b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4028,7 +4028,7 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); @@ -4101,7 +4101,7 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index f83b4ad361..1f0a7bebb3 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -93,7 +93,7 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); #endif diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index 15f81e1a2f..30ee22c5de 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -303,7 +303,7 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { -// TheSuperHackers @info helmutbuhler 06/05/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 06/05/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index bf7673e5db..00a0d411a9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -681,7 +681,7 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName, Real s = sin(angle); Real c = cos(angle); -// TheSuperHackers @info helmutbuhler 21/04/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 21/04/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("buildAIBaseDefenseStructure -- Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c)); DEBUG_LOG(("buildAIBaseDefenseStructure -- Offset is %f %f, Final Position is %f, %f \n", diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 2dbef939d4..69cf8707ff 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4149,7 +4149,7 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); @@ -4222,7 +4222,7 @@ StateReturnType AIFollowWaypointPathState::update() if (getAdjustsDestination() && ai->isDoingGroundMovement()) { if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) { if (m_currentWaypoint) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n", m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str())); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 7601070a0c..7fe5381a08 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -94,7 +94,7 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b) Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex, const Coord3D *targetPos ) { -// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); #endif diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index ac3ed05f18..dd94155d99 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp @@ -321,7 +321,7 @@ Real PhysicsBehavior::getZFriction() const */ void PhysicsBehavior::applyForce( const Coord3D *force ) { -// TheSuperHackers @info helmutbuhler 06/05/2025 This debug mutates the code to become not CRC compatible +// TheSuperHackers @info helmutbuhler 06/05/2025 This debug mutates the code to become CRC incompatible #if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n")); #endif