Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5096,6 +5096,10 @@ StateReturnType AIAttackFireWeaponState::update()

if (m_att->isAttackingObject())
{
// Re-validate victim immediately before firing; it may have been destroyed since the earlier check.
if (!victim || victim->isEffectivelyDead())
return STATE_FAILURE;

obj->fireCurrentWeapon(victim);
// clear this, just in case.
obj->clearStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IGNORING_STEALTH ) );
Expand Down
3 changes: 3 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5256,6 +5256,9 @@ StateReturnType AIAttackFireWeaponState::update()
// If the concept of linked turrets is further developed then God help you, and put more code right here
// that lookl like the //LINKED TURRETS// block, below

// Re-validate victim immediately before firing; it may have been destroyed since the earlier check.
if (!victim || victim->isEffectivelyDead())
return STATE_FAILURE;

obj->fireCurrentWeapon(victim);

Expand Down
Loading