bugfix: Sniper weapons can no longer fire upon empty Stinger Sites#2822
bugfix: Sniper weapons can no longer fire upon empty Stinger Sites#2822Stubbjax wants to merge 2 commits into
Conversation
|
| Filename | Overview |
|---|---|
| GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h | Adds pure virtual getSlaveCount() to SpawnBehaviorInterface and an inline implementation on SpawnBehavior that returns m_spawnCount; no other implementors exist so the change compiles cleanly. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp | Adds an else branch to the DAMAGE_SNIPER / KINDOF_STRUCTURE guard: when no contain module is present, checks the spawn-behavior slave count and returns 0 if <= 0, correctly blocking sniper targeting of empty Stinger Sites (including the NONE_SPAWNED_YET sentinel of -1). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["estimateWeaponTemplateDamage()"] --> B{"isKindOf STRUCTURE AND DAMAGE_SNIPER?"}
B -->|No| Z[Continue normal evaluation]
B -->|Yes| C{"getContain() not null?"}
C -->|Yes| D{"getContainCount() == 0?"}
D -->|Yes| E["return 0.0f - cannot target"]
D -->|No| Z
C -->|"No - new else branch"| F["getSpawnBehaviorInterface()"]
F --> G{"spawnInterface not null?"}
G -->|No| Z
G -->|Yes| H{"getSlaveCount() <= 0?"}
H -->|"Yes: -1=NONE_SPAWNED_YET or 0=all dead"| E
H -->|No| Z
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["estimateWeaponTemplateDamage()"] --> B{"isKindOf STRUCTURE AND DAMAGE_SNIPER?"}
B -->|No| Z[Continue normal evaluation]
B -->|Yes| C{"getContain() not null?"}
C -->|Yes| D{"getContainCount() == 0?"}
D -->|Yes| E["return 0.0f - cannot target"]
D -->|No| Z
C -->|"No - new else branch"| F["getSpawnBehaviorInterface()"]
F --> G{"spawnInterface not null?"}
G -->|No| Z
G -->|Yes| H{"getSlaveCount() <= 0?"}
H -->|"Yes: -1=NONE_SPAWNED_YET or 0=all dead"| E
H -->|No| Z
Reviews (3): Last reviewed commit: "tweak: Cover unspawned states" | Re-trigger Greptile
3adccd8 to
290abfd
Compare
| if ( victimObj->getContain()->getContainCount() == 0 ) | ||
| return 0.0f; | ||
| } | ||
| #if !RETAIL_COMPATIBLE_CRC |
There was a problem hiding this comment.
This may also need a PRESERVE_SNIPER_STINGER_BEHAVIOR flag
The fix significantly increases the effectiveness of the sniper against GLA bases.
May need to be checked with The Comity
Fixes #1590 from the patch repository
This change prevents sniper weapons from being able to fire upon empty Stinger Sites. Behaviour is now consistent with occupied / empty Fire Bases.
This change only applies to Zero Hour as the Generals implementation is different and it makes more sense to carry the fix there during the unification process.
Before
BEFORE_SNIPE.mp4
After
AFTER_SNIPE.mp4