Skip to content

[GEN][ZH] Fix Retail Mismatch in Release Build when Logging is enabled #759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
87c269b
Fix mismatch in release+logging build when AI player is involved
helmutbuhler Apr 21, 2025
d520d28
Gen: Fix mismatch in release+logging build when AI player is involved
helmutbuhler Apr 21, 2025
22fb160
Fix date in comments
helmutbuhler Apr 21, 2025
643123b
ZH: Fix logs that mismatch on Release in StateMachine
helmutbuhler Apr 26, 2025
559e701
Gen: Fix logs that mismatch on Release in StateMachine
helmutbuhler Apr 26, 2025
a5791ab
Merge branch 'main' into fix_mm_in_release_logging_sh
helmutbuhler Apr 26, 2025
f83ec49
ZH Gen: Fix crash when version is logged in debug build and replay ve…
helmutbuhler May 5, 2025
17fca13
GEN ZH Remove Debug condition on DEBUG_LOGs in StateMachine. They are…
helmutbuhler May 5, 2025
b10df8e
GEN ZH: Fix format #d -> %d
helmutbuhler May 5, 2025
e05e1b2
Fix another mismatch due to logging
helmutbuhler May 5, 2025
b0a340d
Fix yet another mm in Release. This time when DEBUG_CRASHING is enabled
helmutbuhler May 5, 2025
153adce
Fix another mm when DEBUG_CRASHING is defined
helmutbuhler May 5, 2025
b9db1d4
Sync with Generals
helmutbuhler May 6, 2025
4ca0a86
Merge branch 'main' into fix_mm_in_release_logging_sh
helmutbuhler May 6, 2025
578bb75
Rename defines to RTS_DEBUG and RTS_INTERNAL
helmutbuhler May 6, 2025
fc0ba7d
Remove Unicode fix in RecorderClass::playbackFile
helmutbuhler May 6, 2025
5b6be60
Add stupid else-block back
helmutbuhler May 6, 2025
089ebe0
Merge branch 'main' into fix_mm_in_release_logging_sh
helmutbuhler Jun 16, 2025
78c811d
Move comments
helmutbuhler Jun 16, 2025
12df09a
Simplify comments and do not compile out with !RETAIL_COMPATIBLE_CRC
xezon Jun 26, 2025
91d8a27
Revert unrelated changes in StateMachine
xezon Jun 26, 2025
f60fbda
Revert "Revert unrelated changes in StateMachine"
xezon Jun 26, 2025
26773d5
Revert unrelated changes in StateMachine 2
xezon Jun 26, 2025
977a977
Optimize comment wording
xezon Jun 26, 2025
4b6f9e1
Optimize comment wording 2
xezon Jun 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,15 @@ 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));
// 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",
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;
Expand Down
6 changes: 6 additions & 0 deletions Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4028,8 +4028,11 @@ 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 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()));
#endif
}
return STATE_FAILURE;
}
Expand Down Expand Up @@ -4098,8 +4101,11 @@ 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 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()));
#endif
}
return STATE_FAILURE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ 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 CRC incompatible
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited"));
#endif

// sanity
if( targetPos == NULL || m_garrisonPointsInUse == MAX_GARRISON_POINTS )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,10 @@ Real PhysicsBehavior::getZFriction() const
*/
void PhysicsBehavior::applyForce( const Coord3D *force )
{
// 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
if (_isnan(force->x) || _isnan(force->y) || _isnan(force->z)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,12 +681,15 @@ 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));
// 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",
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;
Expand Down
6 changes: 6 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4149,8 +4149,11 @@ 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 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()));
#endif
}
return STATE_FAILURE;
}
Expand Down Expand Up @@ -4219,8 +4222,11 @@ 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 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()));
#endif
}
return STATE_FAILURE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ 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 CRC incompatible
#if (defined(RTS_DEBUG) || defined(RTS_INTERNAL)) || !RETAIL_COMPATIBLE_CRC
DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited"));
#endif

// sanity
if( targetPos == NULL || m_garrisonPointsInUse == MAX_GARRISON_POINTS )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,10 @@ Real PhysicsBehavior::getZFriction() const
*/
void PhysicsBehavior::applyForce( const Coord3D *force )
{
// 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
if (_isnan(force->x) || _isnan(force->y) || _isnan(force->z)) {
return;
}
Expand Down
Loading