You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change prevents collateral damage caused by VehicleCrashesIntoBuildingWeapon when a dead vehicle collides with a building. This fix is supplemental to #2204.
Before
The Tank Hunters receive damage if the dead Helix collides with the Bunker
INJURED.mp4
After
The Tank Hunters no longer receive damage if the dead Helix collides with the Bunker
Stubbjax
added
Bug
Something is not working right, typically is user facing
Minor
Severity: Minor < Major < Critical < Blocker
Gen
Relates to Generals
ZH
Relates to Zero Hour
NoRetail
This fix or change is not applicable with Retail game compatibility
labels
May 17, 2026
This PR fixes collateral damage caused by VehicleCrashesIntoBuildingWeapon when a dead vehicle collides with a building, supplementing the earlier fix in #2204. Under RETAIL_COMPATIBLE_CRC the original createAndFireTempWeapon path (which fires an AoE explosion affecting nearby units) is preserved; outside retail mode a targeted DamageInfo is built and applied directly to the building only.
The new DamageInfo construction mirrors the pattern in Weapon.cpp::dealDamageInternal, setting m_damageType, m_deathType, m_sourceID, m_sourcePlayerMask, and m_amount — all required fields.
The null guard if (weaponTemplate != nullptr) addresses the previously flagged crash risk when the template is absent; FXList::doFXObj is a null-safe static wrapper so a missing FireFX is also safe.
Both the Generals/ and GeneralsMD/ copies receive identical changes, as expected for a parity fix.
Confidence Score: 5/5
Safe to merge — the change is narrow, correctly guards against a null weapon template, and applies damage only to the building using the same DamageInfo pattern used throughout the engine.
The fix is self-contained: it replaces an AoE weapon fire with a direct single-target damage call, uses the standard DamageInfo field set that matches Weapon.cpp, includes the null guard for the weapon template, and relies on the null-safe FXList::doFXObj static wrapper. No regressions are introduced in the retail path, which is left unchanged.
Adds non-retail path that applies crash damage directly to the struck building via DamageInfo rather than firing an AoE weapon; null guard and FX call are both safe.
Zero Hour counterpart receives the identical change; no issues found.
Sequence Diagram
sequenceDiagram
participant Physics as PhysicsBehavior::onCollide
participant WT as WeaponTemplate
participant WS as WeaponStore
participant Bldg as Building (other)
participant FX as FXList
Note over Physics: Vehicle falls into structure
alt RETAIL_COMPATIBLE_CRC
Physics->>WS: createAndFireTempWeapon(template, obj, pos)
WS->>Bldg: AoE explosion — damages building AND nearby units
else Non-retail (this PR)
Physics->>WT: getDamageType / getDeathType / getPrimaryDamage
WT-->>Physics: damage values
Note over Physics: weaponTemplate nullptr check
Physics->>Bldg: attemptDamage(DamageInfo) — building only
Physics->>FX: doFXObj(getFireFX, obj) — visual effect only
end
Physics->>Physics: destroyObject(obj)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BugSomething is not working right, typically is user facingGenRelates to GeneralsMinorSeverity: Minor < Major < Critical < BlockerNoRetailThis fix or change is not applicable with Retail game compatibilityZHRelates to Zero Hour
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change prevents collateral damage caused by
VehicleCrashesIntoBuildingWeaponwhen a dead vehicle collides with a building. This fix is supplemental to #2204.Before
The Tank Hunters receive damage if the dead Helix collides with the Bunker
INJURED.mp4
After
The Tank Hunters no longer receive damage if the dead Helix collides with the Bunker
HEALTHY.mp4