unify(update): Parse template references in the AssistedTargetingUpdate module by name#2809
Conversation
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h | Moves laser template pointers from ModuleData to AssistedTargetingUpdate instance; introduces AsciiString name fields in ModuleData. Constructor initialisation fix included. |
| Generals/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp | Replaces INI::parseThingTemplate with INI::parseAsciiString; adds nullptr initialisation in constructor; resolves names to pointers in update() and loadPostProcess(). All previously flagged P0 bugs are addressed. |
| GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h | Indentation cleanup (spaces→tabs) and removal of redundant AsciiString::clear() calls in constructor; no logic changes. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp | Indentation cleanup and setPosition reorder (moved after LaserUpdate null-check, before initLaser — safe). Copy-paste bugs from previous review are fixed; both template names now resolve to their correct pointers. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant INI as INI Parser
participant MD as ModuleData
participant ATU as AssistedTargetingUpdate
participant TF as TheThingFactory
INI->>MD: parseAsciiString to m_laserFromAssistedName
INI->>MD: parseAsciiString to m_laserToTargetName
INI->>ATU: construct
ATU->>ATU: "m_laserFromAssisted = nullptr"
ATU->>ATU: "m_laserToTarget = nullptr"
ATU->>ATU: update() on first tick
ATU->>TF: findTemplate(m_laserFromAssistedName)
TF-->>ATU: ThingTemplate ptr
ATU->>TF: findTemplate(m_laserToTargetName)
TF-->>ATU: ThingTemplate ptr
ATU-->>ATU: return UPDATE_SLEEP_FOREVER
ATU->>ATU: assistAttack called
ATU->>ATU: makeFeedbackLaser if ptr set
%%{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"}}}%%
sequenceDiagram
participant INI as INI Parser
participant MD as ModuleData
participant ATU as AssistedTargetingUpdate
participant TF as TheThingFactory
INI->>MD: parseAsciiString to m_laserFromAssistedName
INI->>MD: parseAsciiString to m_laserToTargetName
INI->>ATU: construct
ATU->>ATU: "m_laserFromAssisted = nullptr"
ATU->>ATU: "m_laserToTarget = nullptr"
ATU->>ATU: update() on first tick
ATU->>TF: findTemplate(m_laserFromAssistedName)
TF-->>ATU: ThingTemplate ptr
ATU->>TF: findTemplate(m_laserToTargetName)
TF-->>ATU: ThingTemplate ptr
ATU-->>ATU: return UPDATE_SLEEP_FOREVER
ATU->>ATU: assistAttack called
ATU->>ATU: makeFeedbackLaser if ptr set
Reviews (4): Last reviewed commit: "refactor: Further reduce class divergenc..." | Re-trigger Greptile
8e0db49 to
818dfe9
Compare
xezon
left a comment
There was a problem hiding this comment.
I suggest split merge from the other fix.
720da12 to
c603a48
Compare
c603a48 to
5791c2a
Compare
This change improves the way in which the
AssistedTargetingUpdatemodule parses template reference fields in Generals by standardising the logic with Zero Hour.As a result, the respective objects can be defined in any order, whereas previously e.g. the
PatriotBinaryDataStreamwould have to be defined before any reference within anAssistedTargetingUpdatemodule (otherwise theLaserFromAssistedandLaserToTargetfields would be left unassigned).Before
✅ Valid
❌ Invalid
After
✅ Valid
✅ Valid