Skip to content

Commit 7e18d29

Browse files
authored
[GEN][ZH] Fix Retail Mismatch in Release Build when Logging is enabled (#759)
1 parent 222a7bf commit 7e18d29

File tree

8 files changed

+34
-4
lines changed

8 files changed

+34
-4
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,12 +672,15 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName,
672672
Real s = sin(angle);
673673
Real c = cos(angle);
674674

675-
DEBUG_LOG(("Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c));
675+
// TheSuperHackers @info helmutbuhler 21/04/2025 This debug mutates the code to become CRC incompatible
676+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
677+
DEBUG_LOG(("Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c));
676678
DEBUG_LOG(("Offset is %f %f, new is %f, %f \n",
677679
offset.x, offset.y,
678680
offset.x*c - offset.y*s,
679681
offset.y*c + offset.x*s
680-
));
682+
));
683+
#endif
681684
Coord3D buildPos = m_baseCenter;
682685
buildPos.x += offset.x*c - offset.y*s;
683686
buildPos.y += offset.y*c + offset.x*s;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4028,8 +4028,11 @@ StateReturnType AIFollowWaypointPathState::update()
40284028
if (getAdjustsDestination() && ai->isDoingGroundMovement()) {
40294029
if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) {
40304030
if (m_currentWaypoint) {
4031+
// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible
4032+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
40314033
DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n",
40324034
m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str()));
4035+
#endif
40334036
}
40344037
return STATE_FAILURE;
40354038
}
@@ -4098,8 +4101,11 @@ StateReturnType AIFollowWaypointPathState::update()
40984101
if (getAdjustsDestination() && ai->isDoingGroundMovement()) {
40994102
if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) {
41004103
if (m_currentWaypoint) {
4104+
// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible
4105+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
41014106
DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n",
41024107
m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str()));
4108+
#endif
41034109
}
41044110
return STATE_FAILURE;
41054111
}

Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b)
9393
Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex,
9494
const Coord3D *targetPos )
9595
{
96+
// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible
97+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
9698
DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited"));
99+
#endif
97100

98101
// sanity
99102
if( targetPos == NULL || m_garrisonPointsInUse == MAX_GARRISON_POINTS )

Generals/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@ Real PhysicsBehavior::getZFriction() const
303303
*/
304304
void PhysicsBehavior::applyForce( const Coord3D *force )
305305
{
306+
// TheSuperHackers @info helmutbuhler 06/05/2025 This debug mutates the code to become CRC incompatible
307+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
306308
DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n"));
309+
#endif
307310
if (_isnan(force->x) || _isnan(force->y) || _isnan(force->z)) {
308311
return;
309312
}

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,12 +681,15 @@ void AISkirmishPlayer::buildAIBaseDefenseStructure(const AsciiString &thingName,
681681
Real s = sin(angle);
682682
Real c = cos(angle);
683683

684-
DEBUG_LOG(("buildAIBaseDefenseStructure -- Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c));
684+
// TheSuperHackers @info helmutbuhler 21/04/2025 This debug mutates the code to become CRC incompatible
685+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
686+
DEBUG_LOG(("buildAIBaseDefenseStructure -- Angle is %f sin %f, cos %f \n", 180*angle/PI, s, c));
685687
DEBUG_LOG(("buildAIBaseDefenseStructure -- Offset is %f %f, Final Position is %f, %f \n",
686688
offset.x, offset.y,
687689
offset.x*c - offset.y*s,
688690
offset.y*c + offset.x*s
689-
));
691+
));
692+
#endif
690693
Coord3D buildPos = m_baseCenter;
691694
buildPos.x += offset.x*c - offset.y*s;
692695
buildPos.y += offset.y*c + offset.x*s;

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4149,8 +4149,11 @@ StateReturnType AIFollowWaypointPathState::update()
41494149
if (getAdjustsDestination() && ai->isDoingGroundMovement()) {
41504150
if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) {
41514151
if (m_currentWaypoint) {
4152+
// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible
4153+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
41524154
DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n",
41534155
m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str()));
4156+
#endif
41544157
}
41554158
return STATE_FAILURE;
41564159
}
@@ -4219,8 +4222,11 @@ StateReturnType AIFollowWaypointPathState::update()
42194222
if (getAdjustsDestination() && ai->isDoingGroundMovement()) {
42204223
if (!TheAI->pathfinder()->adjustDestination(obj, ai->getLocomotorSet(), &m_goalPosition)) {
42214224
if (m_currentWaypoint) {
4225+
// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible
4226+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
42224227
DEBUG_LOG(("Breaking out of follow waypoint path %s of %s\n",
42234228
m_currentWaypoint->getName().str(), m_currentWaypoint->getPathLabel1().str()));
4229+
#endif
42244230
}
42254231
return STATE_FAILURE;
42264232
}

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ inline Real calcDistSqr(const Coord3D& a, const Coord3D& b)
9494
Int GarrisonContain::findClosestFreeGarrisonPointIndex( Int conditionIndex,
9595
const Coord3D *targetPos )
9696
{
97+
// TheSuperHackers @info helmutbuhler 05/05/2025 This debug mutates the code to become CRC incompatible
98+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
9799
DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited"));
100+
#endif
98101

99102
// sanity
100103
if( targetPos == NULL || m_garrisonPointsInUse == MAX_GARRISON_POINTS )

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,10 @@ Real PhysicsBehavior::getZFriction() const
321321
*/
322322
void PhysicsBehavior::applyForce( const Coord3D *force )
323323
{
324+
// TheSuperHackers @info helmutbuhler 06/05/2025 This debug mutates the code to become CRC incompatible
325+
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
324326
DEBUG_ASSERTCRASH(!(_isnan(force->x) || _isnan(force->y) || _isnan(force->z)), ("PhysicsBehavior::applyForce force NAN!\n"));
327+
#endif
325328
if (_isnan(force->x) || _isnan(force->y) || _isnan(force->z)) {
326329
return;
327330
}

0 commit comments

Comments
 (0)