From f13459548a13725592044938d2d8eaf1762d437b Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 12 Aug 2026 14:24:29 +1000 Subject: [PATCH 1/2] bugfix: Enter commands are now ignored if the target to enter is invalid or ourselves --- .../Object/Update/AIUpdate/ChinookAIUpdate.cpp | 10 ++++++++++ .../Object/Update/AIUpdate/ChinookAIUpdate.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 92b2a72dc8e..7639cb375f5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1165,6 +1165,16 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) setAirfieldForHealing(INVALID_ID); #endif +#if !RETAIL_COMPATIBLE_CRC + // Ignore the command if we are told to enter ourselves (we can be in the same group). + if (parms->m_cmd == AICMD_ENTER && parms->m_obj && parms->m_obj->getID() == getObject()->getID()) + return; + + // Ignore the command if we are told to enter something we cannot (we can be in the same group). + if (parms->m_cmd == AICMD_ENTER && !TheActionManager->canEnterObject(getObject(), parms->m_obj, parms->m_cmdSource, DONT_CHECK_CAPACITY)) + return; +#endif + if (!isAllowedToRespondToAiCommands(parms)) return; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 6c92290ae2d..4c61edc0081 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1296,6 +1296,16 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) setAirfieldForHealing(INVALID_ID); #endif +#if !RETAIL_COMPATIBLE_CRC + // Ignore the command if we are told to enter ourselves (we can be in the same group). + if (parms->m_cmd == AICMD_ENTER && parms->m_obj && parms->m_obj->getID() == getObject()->getID()) + return; + + // Ignore the command if we are told to enter something we cannot (we can be in the same group). + if (parms->m_cmd == AICMD_ENTER && !TheActionManager->canEnterObject(getObject(), parms->m_obj, parms->m_cmdSource, DONT_CHECK_CAPACITY)) + return; +#endif + if (!isAllowedToRespondToAiCommands(parms)) return; From 150932c6d9696aa334b83a02253a6c0370bd7301 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 14 Aug 2026 14:22:03 +1000 Subject: [PATCH 2/2] refactor: Move logic to the switch statement --- .../Update/AIUpdate/ChinookAIUpdate.cpp | 21 ++++++++++--------- .../Update/AIUpdate/ChinookAIUpdate.cpp | 21 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 7639cb375f5..dc1c3214695 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1165,16 +1165,6 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) setAirfieldForHealing(INVALID_ID); #endif -#if !RETAIL_COMPATIBLE_CRC - // Ignore the command if we are told to enter ourselves (we can be in the same group). - if (parms->m_cmd == AICMD_ENTER && parms->m_obj && parms->m_obj->getID() == getObject()->getID()) - return; - - // Ignore the command if we are told to enter something we cannot (we can be in the same group). - if (parms->m_cmd == AICMD_ENTER && !TheActionManager->canEnterObject(getObject(), parms->m_obj, parms->m_cmdSource, DONT_CHECK_CAPACITY)) - return; -#endif - if (!isAllowedToRespondToAiCommands(parms)) return; @@ -1199,6 +1189,17 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) // just pass it thru. } break; +#if !RETAIL_COMPATIBLE_CRC + case AICMD_ENTER: + // TheSuperHackers @bugfix Stubbjax 12/08/2026 Ignore the command if we are told to enter ourselves (we can be in the same group). + if (parms->m_obj && parms->m_obj->getID() == getObject()->getID()) + return; + + // TheSuperHackers @bugfix Stubbjax 12/08/2026 Ignore the command if we are told to enter something we cannot (we can be in the same group). + if (!TheActionManager->canEnterObject(getObject(), parms->m_obj, parms->m_cmdSource, DONT_CHECK_CAPACITY)) + return; + break; +#endif case AICMD_MOVE_TO_POSITION_AND_EVACUATE: case AICMD_MOVE_TO_POSITION_AND_EVACUATE_AND_EXIT: diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index 4c61edc0081..ebaf78f5bbc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -1296,16 +1296,6 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) setAirfieldForHealing(INVALID_ID); #endif -#if !RETAIL_COMPATIBLE_CRC - // Ignore the command if we are told to enter ourselves (we can be in the same group). - if (parms->m_cmd == AICMD_ENTER && parms->m_obj && parms->m_obj->getID() == getObject()->getID()) - return; - - // Ignore the command if we are told to enter something we cannot (we can be in the same group). - if (parms->m_cmd == AICMD_ENTER && !TheActionManager->canEnterObject(getObject(), parms->m_obj, parms->m_cmdSource, DONT_CHECK_CAPACITY)) - return; -#endif - if (!isAllowedToRespondToAiCommands(parms)) return; @@ -1330,6 +1320,17 @@ void ChinookAIUpdate::aiDoCommand(const AICommandParms* parms) // just pass it thru. } break; +#if !RETAIL_COMPATIBLE_CRC + case AICMD_ENTER: + // TheSuperHackers @bugfix Stubbjax 12/08/2026 Ignore the command if we are told to enter ourselves (we can be in the same group). + if (parms->m_obj && parms->m_obj->getID() == getObject()->getID()) + return; + + // TheSuperHackers @bugfix Stubbjax 12/08/2026 Ignore the command if we are told to enter something we cannot (we can be in the same group). + if (!TheActionManager->canEnterObject(getObject(), parms->m_obj, parms->m_cmdSource, DONT_CHECK_CAPACITY)) + return; + break; +#endif case AICMD_MOVE_TO_POSITION_AND_EVACUATE: case AICMD_MOVE_TO_POSITION_AND_EVACUATE_AND_EXIT: