diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index 2eba29b6f7..f5a83d1f69 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -499,8 +499,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; diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 7249508975..65fdc03836 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(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)); 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; diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 92b830bfcc..caac762aea 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -4028,8 +4028,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(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 } return STATE_FAILURE; } @@ -4098,8 +4101,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(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 } 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 eb9eb21d58..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,11 @@ 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. 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 b79daea4c5..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,11 @@ 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. 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; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index d98c866f36..b9a5b1dff2 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(("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/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index b629a1519c..3b8c19fa88 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(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)); 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; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 4568e6bfae..648c0dc2d0 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(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 } 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(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 } return STATE_FAILURE; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index a31e291bad..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,11 @@ 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. DEBUG_ASSERTCRASH(m_garrisonPointsInitialized, ("garrisonPoints are not inited")); +#endif // sanity if( targetPos == NULL || m_garrisonPointsInUse == MAX_GARRISON_POINTS ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp index c7b7f08d7a..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,11 @@ 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. 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; }