refactor(object): Replace explicit local player checks with Object::isLocallyControlled#2512
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/SelectionInfo.cpp | Replaces one getControllingPlayer() != ThePlayerList->getLocalPlayer() check with !isLocallyControlled() — semantically identical. |
| Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp | Two sanity-check comparisons (cancel construction and cancel production) updated to use isLocallyControlled() — no behavioral change. |
| Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp | UI notification guard for overcharge updated to isLocallyControlled() — equivalent replacement. |
| Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp | Final condition in attemptDamage radar-event guard replaced with isLocallyControlled() — equivalent; pre-existing absence of a null-guard on getControllingPlayer() is unchanged by this PR. |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp | Same two sanity-check comparisons as the Generals counterpart updated to isLocallyControlled() — no behavioral change. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/OverchargeBehavior.cpp | UI notification guard updated to isLocallyControlled() — equivalent to Generals counterpart. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp | Selection message guard for rider dismount uses isLocallyControlled() — equivalent; no corresponding Generals file exists, so no mirror update needed. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp | Final condition in attemptDamage radar-event guard replaced with isLocallyControlled(); the existing getControllingPlayer() && null-guard immediately preceding it remains intact. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp | Control bar dirty-mark check in destroyObject updated to isLocallyControlled() — equivalent replacement. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Call site (e.g. attemptDamage, processCommandUI, etc.)"]
B["obj->isLocallyControlled()"]
C["getControllingPlayer()"]
D["ThePlayerList->getLocalPlayer()"]
E{"=="}
F["Bool result"]
A --> B
B --> C
B --> D
C --> E
D --> E
E --> F
style B fill:#d4edda,stroke:#28a745
style A fill:#cce5ff,stroke:#004085
Reviews (3): Last reviewed commit: "Replicated in Generals (manually)." | Re-trigger Greptile
…sLocallyControlled
2b3edd3 to
97806ac
Compare
|
Replicated in Generals. |
GeneralsGameCode/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
Lines 1727 to 1730 in 90afd63
This PR replaces a couple of checks such as
if (object->getControllingPlayer() == ThePlayerList->getLocalPlayer())with
if (object->isLocallyControlled())TODO: