diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 7ce23ef377e..385ae65a089 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -1016,6 +1016,13 @@ void AIStateMachine::clear() m_goalWaypoint = nullptr; m_goalSquad = nullptr; +#if !RETAIL_COMPATIBLE_CRC + if (m_temporaryState) + m_temporaryState->onExit(EXIT_RESET); + + m_temporaryState = nullptr; +#endif + AIUpdateInterface* ai = getOwner()->getAI(); if (ai) ai->friend_notifyStateMachineChanged(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp index 284df0b2abb..314c5fee168 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp @@ -672,6 +672,9 @@ void OpenContain::scatterToNearbyPosition(Object* rider) // set position of the object at center of building and move them toward pos rider->setPosition( theContainer->getPosition() ); ai->ignoreObstacle(theContainer); +#if !RETAIL_COMPATIBLE_CRC + ai->friend_setGoalObject(nullptr); +#endif ai->aiMoveToPosition( &pos, CMD_FROM_AI ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index f78e882cc0c..93474df91f7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -1021,6 +1021,13 @@ void AIStateMachine::clear() m_goalWaypoint = nullptr; m_goalSquad = nullptr; +#if !RETAIL_COMPATIBLE_CRC + if (m_temporaryState) + m_temporaryState->onExit(EXIT_RESET); + + m_temporaryState = nullptr; +#endif + AIUpdateInterface* ai = getOwner()->getAI(); if (ai) ai->friend_notifyStateMachineChanged(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp index 7ed6622ebf7..baea90bf2c5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp @@ -768,6 +768,9 @@ void OpenContain::scatterToNearbyPosition(Object* rider) // set position of the object at center of building and move them toward pos rider->setPosition( theContainer->getPosition() ); ai->ignoreObstacle(theContainer); +#if !RETAIL_COMPATIBLE_CRC + ai->friend_setGoalObject(nullptr); +#endif ai->aiMoveToPosition( &pos, CMD_FROM_AI ); }