Skip to content

Commit 6aab954

Browse files
authored
bugfix(behavior): Allow multiple InstantDeathBehavior modules to be processed (TheSuperHackers#2990)
1 parent 1f47110 commit 6aab954

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )
124124
if (!isDieApplicable(damageInfo))
125125
return;
126126

127+
#if RETAIL_COMPATIBLE_CRC
127128
AIUpdateInterface* ai = getObject()->getAIUpdateInterface();
128129
if (ai)
129130
{
@@ -132,6 +133,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )
132133
return;
133134
ai->markAsDead();
134135
}
136+
#endif
135137

136138
const InstantDeathBehaviorModuleData* d = getInstantDeathBehaviorModuleData();
137139

@@ -170,6 +172,19 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )
170172
}
171173
}
172174

175+
#if !RETAIL_COMPATIBLE_CRC
176+
// TheSuperHackers @bugfix Stubbjax 21/07/2026 Allow multiple InstantDeathBehaviors to be processed.
177+
// Multiple FXListDie, CreateObjectDie and FireWeaponWhenDeadBehavior modules are already supported.
178+
AIUpdateInterface* ai = getObject()->getAIUpdateInterface();
179+
if (ai)
180+
{
181+
// has another AI already handled us. (hopefully another InstantDeathBehavior)
182+
if (ai->isAiInDeadState())
183+
return;
184+
ai->markAsDead();
185+
}
186+
#endif
187+
173188
TheGameLogic->destroyObject(getObject());
174189
}
175190

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )
124124
if (!isDieApplicable(damageInfo))
125125
return;
126126

127+
#if RETAIL_COMPATIBLE_CRC
127128
AIUpdateInterface* ai = getObject()->getAIUpdateInterface();
128129
if (ai)
129130
{
@@ -132,6 +133,7 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )
132133
return;
133134
ai->markAsDead();
134135
}
136+
#endif
135137

136138
const InstantDeathBehaviorModuleData* d = getInstantDeathBehaviorModuleData();
137139

@@ -170,6 +172,19 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )
170172
}
171173
}
172174

175+
#if !RETAIL_COMPATIBLE_CRC
176+
// TheSuperHackers @bugfix Stubbjax 21/07/2026 Allow multiple InstantDeathBehaviors to be processed.
177+
// Multiple FXListDie, CreateObjectDie and FireWeaponWhenDeadBehavior modules are already supported.
178+
AIUpdateInterface* ai = getObject()->getAIUpdateInterface();
179+
if (ai)
180+
{
181+
// has another AI already handled us. (hopefully another InstantDeathBehavior)
182+
if (ai->isAiInDeadState())
183+
return;
184+
ai->markAsDead();
185+
}
186+
#endif
187+
173188
TheGameLogic->destroyObject(getObject());
174189
}
175190

0 commit comments

Comments
 (0)