From 211852bac68ad8cacd30359a7e38b37898fec232 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 21 Jul 2026 17:19:50 +1000 Subject: [PATCH] bugfix: Allow multiple InstantDeathBehavior modules to be processed --- .../Object/Behavior/InstantDeathBehavior.cpp | 15 +++++++++++++++ .../Object/Behavior/InstantDeathBehavior.cpp | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp index aa3126b588e..d3f4de7d72a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp @@ -124,6 +124,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) if (!isDieApplicable(damageInfo)) return; +#if RETAIL_COMPATIBLE_CRC AIUpdateInterface* ai = getObject()->getAIUpdateInterface(); if (ai) { @@ -132,6 +133,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) return; ai->markAsDead(); } +#endif const InstantDeathBehaviorModuleData* d = getInstantDeathBehaviorModuleData(); @@ -170,6 +172,19 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) } } +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 21/07/2026 Allow multiple InstantDeathBehaviors to be processed. + // Multiple FXListDie, CreateObjectDie and FireWeaponWhenDeadBehavior modules are already supported. + AIUpdateInterface* ai = getObject()->getAIUpdateInterface(); + if (ai) + { + // has another AI already handled us. (hopefully another InstantDeathBehavior) + if (ai->isAiInDeadState()) + return; + ai->markAsDead(); + } +#endif + TheGameLogic->destroyObject(getObject()); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp index cc2695115a4..5d852c78606 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp @@ -124,6 +124,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) if (!isDieApplicable(damageInfo)) return; +#if RETAIL_COMPATIBLE_CRC AIUpdateInterface* ai = getObject()->getAIUpdateInterface(); if (ai) { @@ -132,6 +133,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) return; ai->markAsDead(); } +#endif const InstantDeathBehaviorModuleData* d = getInstantDeathBehaviorModuleData(); @@ -170,6 +172,19 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo ) } } +#if !RETAIL_COMPATIBLE_CRC + // TheSuperHackers @bugfix Stubbjax 21/07/2026 Allow multiple InstantDeathBehaviors to be processed. + // Multiple FXListDie, CreateObjectDie and FireWeaponWhenDeadBehavior modules are already supported. + AIUpdateInterface* ai = getObject()->getAIUpdateInterface(); + if (ai) + { + // has another AI already handled us. (hopefully another InstantDeathBehavior) + if (ai->isAiInDeadState()) + return; + ai->markAsDead(); + } +#endif + TheGameLogic->destroyObject(getObject()); }