fix(alarm): Disable radar alarms for USA cargo planes#2862
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/Common/GameDefines.h | Adds PRESERVE_CARGO_PLANE_ATTACK_WARNINGS defaulting to (0); missing the approval comment that all other (0)-default PRESERVE macros carry. |
| Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp | Guards tryUnderAttackEvent behind a hardcoded template-name check for "AmericaJetCargoPlane"; logic is correct and well-scoped behind existing guards (m_radarData, isLocallyControlled). |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp | Mirrors the Generals change; Zero Hour version already has the getControllingPlayer() null guard so the new code slots in cleanly. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Object::attemptDamage called] --> B{actualDamageDealt > 0\nNot PENALTY or HEALING\nm_radarData != null\nisLocallyControlled}
B -- No --> Z[Skip radar event]
B -- Yes --> C{PRESERVE_CARGO_PLANE_ATTACK_WARNINGS == 0?}
C -- Yes --> D{getTemplate name ==\n'AmericaJetCargoPlane'?}
D -- Yes --> Z
D -- No --> E[TheRadar->tryUnderAttackEvent]
C -- No --> E
%%{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[Object::attemptDamage called] --> B{actualDamageDealt > 0\nNot PENALTY or HEALING\nm_radarData != null\nisLocallyControlled}
B -- No --> Z[Skip radar event]
B -- Yes --> C{PRESERVE_CARGO_PLANE_ATTACK_WARNINGS == 0?}
C -- Yes --> D{getTemplate name ==\n'AmericaJetCargoPlane'?}
D -- Yes --> Z
D -- No --> E[TheRadar->tryUnderAttackEvent]
C -- No --> E
Reviews (5): Last reviewed commit: "style(alarm): De-indent preprocessor dir..." | Re-trigger Greptile
Preprocessor #if/#endif directives are not allowed indentation in this codebase; align with existing convention in the file.
a9c8238 to
acf5208
Compare
|
From my perspective (which is one from modding), I think this fix is not exactly what's needed. Hardcoding it seems the wrong way to go about it. Mods can simply make the SDZ cargo plane untargettable if they want to. It's very unlikely your opponent intercepts the plane before it drops the cash anyway. If the committee deems it absolutely necessary to have targettable SDZ planes (for the sake of distracting AA), I think a better idea is to make a system that can be applied to any object that suppresses radar alarms, like a new |
|
Agree with @WWB2-account People are trying to come up with a solution (I think this is the third PR that is trying to 'fix' this?) without first consulting / discussing what the preferable outcome should be: When (in the broadest sense) should an alarm be (re)fired. |
|
This is a big hack indeed. It totally falls apart when the Object template name is changed. |
This PR does a hardcoded check for Cargo Planes so they do not spam a player in late matches.
This is part of the solution for #2452
Included a PRESERVE_CARGO_PLANE_ATTACK_WARNINGS if check.
Game Design Committee can choose if this needs to be the default. It slightly nerfs USA factions, as they don't get incidental notifications on where Anti-Air units are placed.
But this usually depends on the map on where the Cargo Planes follows the route, which in my opinion makes this too random to be considered a legitimate strategic feature.
While hardcoding for a specific unit might be considered a hack, it's the only way to not inadvertently break possible mods by not altering an entire unit category.