Skip to content

Commit 206aaec

Browse files
committed
bugfix: Abort AIExitState if the containing object dies
1 parent 2bb9b2c commit 206aaec

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6272,7 +6272,12 @@ StateReturnType AIExitState::update()
62726272
//GS. The goal of unified ExitInterfaces dies a horrible death. I can't ask Object for the exit,
62736273
// as removeFromContain is only in the Contain type. I'm splitting the names in shame.
62746274
ExitInterface* goalExitInterface = goal->getContain() ? goal->getContain()->getContainExitInterface() : nullptr;
6275+
#if RETAIL_COMPATIBLE_CRC
62756276
if( goalExitInterface == nullptr )
6277+
#else
6278+
// TheSuperHackers @bugfix Stubbjax 03/05/2026 Stop trying to exit if the container is dead, as we are already ejected.
6279+
if (goalExitInterface == nullptr || goal->isEffectivelyDead())
6280+
#endif
62766281
return STATE_FAILURE;
62776282

62786283
if( goalExitInterface->isExitBusy() )

Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ Bool TransportContain::isSpecificRiderFreeToExit(Object* specificObject)
460460
// TheSuperHackers @bugfix Stubbjax 02/03/2026 If our parent container is held, then we
461461
// are not free to exit.
462462
DEBUG_ASSERTCRASH(specificObject->getContainedBy(), ("rider must be contained"));
463-
if (specificObject->getContainedBy() && specificObject->getContainedBy()->isDisabledByType(DISABLED_HELD))
463+
if (specificObject->getContainedBy()->isDisabledByType(DISABLED_HELD))
464464
return FALSE;
465465
#endif
466466

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6484,7 +6484,12 @@ StateReturnType AIExitState::update()
64846484
//GS. The goal of unified ExitInterfaces dies a horrible death. I can't ask Object for the exit,
64856485
// as removeFromContain is only in the Contain type. I'm splitting the names in shame.
64866486
ExitInterface* goalExitInterface = goal->getContain() ? goal->getContain()->getContainExitInterface() : nullptr;
6487+
#if RETAIL_COMPATIBLE_CRC
64876488
if( goalExitInterface == nullptr )
6489+
#else
6490+
// TheSuperHackers @bugfix Stubbjax 03/05/2026 Stop trying to exit if the container is dead, as we are already ejected.
6491+
if (goalExitInterface == nullptr || goal->isEffectivelyDead())
6492+
#endif
64886493
return STATE_FAILURE;
64896494

64906495
if( goalExitInterface->isExitBusy() )

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ Bool TransportContain::isSpecificRiderFreeToExit(Object* specificObject)
571571
// TheSuperHackers @bugfix Stubbjax 02/03/2026 If our parent container is held, then we
572572
// are not free to exit.
573573
DEBUG_ASSERTCRASH(specificObject->getContainedBy(), ("rider must be contained"));
574-
if (specificObject->getContainedBy() && specificObject->getContainedBy()->isDisabledByType(DISABLED_HELD))
574+
if (specificObject->getContainedBy()->isDisabledByType(DISABLED_HELD))
575575
return FALSE;
576576
#endif
577577

0 commit comments

Comments
 (0)