From a0d8a4b4185fd78ac77768d74d9470ca86d944cd Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sat, 14 Mar 2026 03:23:00 +1100 Subject: [PATCH] bugfix: Fix delays when requesting paths too quickly --- .../Source/GameLogic/Object/Update/AIUpdate.cpp | 8 ++++++++ .../Source/GameLogic/Object/Update/AIUpdate.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index dd3b07d378d..3b7c7c32fc1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -491,6 +491,7 @@ void AIUpdateInterface::requestPath( Coord3D *destination, Bool isFinalGoal ) return; } m_waitingForPath = TRUE; +#if RETAIL_COMPATIBLE_CRC if (m_pathTimestamp > TheGameLogic->getFrame()-3) { /* Requesting path very quickly. Can cause a spin. */ //DEBUG_LOG(("%d Pathfind - repathing in less than 3 frames. Waiting 1 second", @@ -507,6 +508,7 @@ void AIUpdateInterface::requestPath( Coord3D *destination, Bool isFinalGoal ) } return; } +#endif TheAI->pathfinder()->queueForPath(getObject()->getID()); } @@ -524,12 +526,14 @@ void AIUpdateInterface::requestAttackPath( ObjectID victimID, const Coord3D* vic m_isApproachPath = FALSE; m_isSafePath = FALSE; m_waitingForPath = TRUE; +#if RETAIL_COMPATIBLE_CRC if (m_pathTimestamp > TheGameLogic->getFrame()-3) { /* Requesting path very quickly. Can cause a spin. */ //DEBUG_LOG(("%d Pathfind - repathing in less than 3 frames. Waiting 2 second",TheGameLogic->getFrame())); setQueueForPathTime(2*LOGICFRAMES_PER_SECOND); return; } +#endif TheAI->pathfinder()->queueForPath(getObject()->getID()); } @@ -547,12 +551,14 @@ void AIUpdateInterface::requestApproachPath( Coord3D *destination ) m_isApproachPath = TRUE; m_isSafePath = FALSE; m_waitingForPath = TRUE; +#if RETAIL_COMPATIBLE_CRC if (m_pathTimestamp > TheGameLogic->getFrame()-3) { /* Requesting path very quickly. Can cause a spin. */ //DEBUG_LOG(("%d Pathfind - repathing in less than 3 frames. Waiting 2 second",TheGameLogic->getFrame())); setQueueForPathTime(2*LOGICFRAMES_PER_SECOND); return; } +#endif TheAI->pathfinder()->queueForPath(getObject()->getID()); } @@ -571,12 +577,14 @@ void AIUpdateInterface::requestSafePath( ObjectID repulsor ) m_isApproachPath = FALSE; m_isSafePath = TRUE; m_waitingForPath = TRUE; +#if RETAIL_COMPATIBLE_CRC if (m_pathTimestamp > TheGameLogic->getFrame()-3) { /* Requesting path very quickly. Can cause a spin. */ //DEBUG_LOG(("%d Pathfind - repathing in less than 3 frames. Waiting 2 second",TheGameLogic->getFrame())); setQueueForPathTime(2*LOGICFRAMES_PER_SECOND); return; } +#endif TheAI->pathfinder()->queueForPath(getObject()->getID()); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 76c94b122c3..0e03f3fb65c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -496,6 +496,7 @@ void AIUpdateInterface::requestPath( Coord3D *destination, Bool isFinalGoal ) return; } m_waitingForPath = TRUE; +#if RETAIL_COMPATIBLE_CRC if (m_pathTimestamp > TheGameLogic->getFrame()-3) { /* Requesting path very quickly. Can cause a spin. */ //DEBUG_LOG(("%d Pathfind - repathing in less than 3 frames. Waiting 1 second", @@ -512,6 +513,7 @@ void AIUpdateInterface::requestPath( Coord3D *destination, Bool isFinalGoal ) } return; } +#endif TheAI->pathfinder()->queueForPath(getObject()->getID()); } @@ -529,6 +531,7 @@ void AIUpdateInterface::requestAttackPath( ObjectID victimID, const Coord3D* vic m_isApproachPath = FALSE; m_isSafePath = FALSE; m_waitingForPath = TRUE; +#if RETAIL_COMPATIBLE_CRC if (m_pathTimestamp > TheGameLogic->getFrame()-3) { /* Requesting path very quickly. Can cause a spin. */ //DEBUG_LOG(("%d Pathfind - repathing in less than 3 frames. Waiting 2 second",TheGameLogic->getFrame())); @@ -536,6 +539,7 @@ void AIUpdateInterface::requestAttackPath( ObjectID victimID, const Coord3D* vic setLocomotorGoalNone(); return; } +#endif TheAI->pathfinder()->queueForPath(getObject()->getID()); } @@ -553,12 +557,14 @@ void AIUpdateInterface::requestApproachPath( Coord3D *destination ) m_isApproachPath = TRUE; m_isSafePath = FALSE; m_waitingForPath = TRUE; +#if RETAIL_COMPATIBLE_CRC if (m_pathTimestamp > TheGameLogic->getFrame()-3) { /* Requesting path very quickly. Can cause a spin. */ //DEBUG_LOG(("%d Pathfind - repathing in less than 3 frames. Waiting 2 second",TheGameLogic->getFrame())); setQueueForPathTime(2*LOGICFRAMES_PER_SECOND); return; } +#endif TheAI->pathfinder()->queueForPath(getObject()->getID()); } @@ -577,12 +583,14 @@ void AIUpdateInterface::requestSafePath( ObjectID repulsor ) m_isApproachPath = FALSE; m_isSafePath = TRUE; m_waitingForPath = TRUE; +#if RETAIL_COMPATIBLE_CRC if (m_pathTimestamp > TheGameLogic->getFrame()-3) { /* Requesting path very quickly. Can cause a spin. */ //DEBUG_LOG(("%d Pathfind - repathing in less than 3 frames. Waiting 2 second",TheGameLogic->getFrame())); setQueueForPathTime(2*LOGICFRAMES_PER_SECOND); return; } +#endif TheAI->pathfinder()->queueForPath(getObject()->getID()); }