File tree Expand file tree Collapse file tree
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior
Generals/Code/GameEngine/Source/GameLogic/Object/Behavior Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,16 +159,23 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )
159159 ObjectCreationList::create (ocl, getObject (), nullptr );
160160 }
161161
162- listSize = d->m_weapons .size ();
163- if (listSize > 0 )
162+ #if !RETAIL_COMPATIBLE_CRC
163+ // TheSuperHackers @bugfix Stubbjax 23/07/2026 Prevent firing weapons when a scaffold is cancelled
164+ // or destroyed. This logic matches the condition in the FireWeaponWhenDeadBehavior module.
165+ if (!getObject ()->getStatusBits ().test (OBJECT_STATUS_UNDER_CONSTRUCTION ))
166+ #endif
164167 {
165- idx = (size_t )GameLogicRandomValue (0 , listSize-1 );
166- const WeaponTemplateVec& v = d->m_weapons ;
167- DEBUG_ASSERTCRASH (idx>=0 &&idx<v.size (),(" bad idx" ));
168- const WeaponTemplate* wt = v[idx];
169- if (wt)
168+ listSize = d->m_weapons .size ();
169+ if (listSize > 0 )
170170 {
171- TheWeaponStore->createAndFireTempWeapon (wt, getObject (), getObject ()->getPosition ());
171+ idx = (size_t )GameLogicRandomValue (0 , listSize-1 );
172+ const WeaponTemplateVec& v = d->m_weapons ;
173+ DEBUG_ASSERTCRASH (idx>=0 &&idx<v.size (),(" bad idx" ));
174+ const WeaponTemplate* wt = v[idx];
175+ if (wt)
176+ {
177+ TheWeaponStore->createAndFireTempWeapon (wt, getObject (), getObject ()->getPosition ());
178+ }
172179 }
173180 }
174181
Original file line number Diff line number Diff line change @@ -159,16 +159,23 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )
159159 ObjectCreationList::create (ocl, getObject (), nullptr );
160160 }
161161
162- listSize = d->m_weapons .size ();
163- if (listSize > 0 )
162+ #if !RETAIL_COMPATIBLE_CRC
163+ // TheSuperHackers @bugfix Stubbjax 23/07/2026 Prevent firing weapons when a scaffold is cancelled
164+ // or destroyed. This logic matches the condition in the FireWeaponWhenDeadBehavior module.
165+ if (!getObject ()->getStatusBits ().test (OBJECT_STATUS_UNDER_CONSTRUCTION ))
166+ #endif
164167 {
165- idx = (size_t )GameLogicRandomValue (0 , listSize-1 );
166- const WeaponTemplateVec& v = d->m_weapons ;
167- DEBUG_ASSERTCRASH (idx>=0 &&idx<v.size (),(" bad idx" ));
168- const WeaponTemplate* wt = v[idx];
169- if (wt)
168+ listSize = d->m_weapons .size ();
169+ if (listSize > 0 )
170170 {
171- TheWeaponStore->createAndFireTempWeapon (wt, getObject (), getObject ()->getPosition ());
171+ idx = (size_t )GameLogicRandomValue (0 , listSize-1 );
172+ const WeaponTemplateVec& v = d->m_weapons ;
173+ DEBUG_ASSERTCRASH (idx>=0 &&idx<v.size (),(" bad idx" ));
174+ const WeaponTemplate* wt = v[idx];
175+ if (wt)
176+ {
177+ TheWeaponStore->createAndFireTempWeapon (wt, getObject (), getObject ()->getPosition ());
178+ }
172179 }
173180 }
174181
You can’t perform that action at this time.
0 commit comments