refactor(metaevent): Split MetaEventTranslator::translateGameMessage() into smaller functions#2758
refactor(metaevent): Split MetaEventTranslator::translateGameMessage() into smaller functions#2758xezon wants to merge 2 commits into
Conversation
…) into smaller functions
|
| Filename | Overview |
|---|---|
| GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h | Adds six new helper method declarations to MetaEventTranslator in the public section; visibility concern already tracked in prior review thread. |
| GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp | translateGameMessage split into six smaller methods; logic is preserved faithfully across all branches including the modifier-key-release path and key-down bookkeeping. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["translateGameMessage(msg)"] --> B{msg type?}
B -->|KEY_DOWN or KEY_UP| C["onKeyEvent(msg, disp)"]
B -->|RAW_MOUSE_BEGIN..END| D["onMouseEvent(msg)"]
B -->|other| E["return KEEP_MESSAGE"]
C --> F["getActionKeyType(systemKey) → keyType"]
C --> G["getKeyModState(systemKeyState) → keyModState"]
C --> H{keyType == MK_NONE AND KEY_UP?}
H -->|yes — modifier released| I["onKeyModStateRemoved(disp, keyModState)"]
H -->|no — regular key event| J["onKeyPressed(disp, systemKeyState, keyType, keyModState)"]
I --> I1["Iterate m_keyDownInfos\nfire UP meta-events\nclearKeyModState"]
J --> J1["Iterate TheMetaMap\ndispatch meta-event if match"]
J --> J2{KEY_STATE_DOWN?}
J2 -->|yes| J3["setKeyModState for keyType"]
J2 -->|no| J4["clearKeyModState for keyType"]
D --> D1["Resolve mouse button index\n(LEFT/MIDDLE/RIGHT via FALLTHROUGH)"]
D1 --> D2{event kind}
D2 -->|DOWN| D3["record m_mouseDownPosition\nclear double-click flag"]
D2 -->|DOUBLE CLICK| D4["set double-click flag"]
D2 -->|UP| D5["insert CLICK or DOUBLE_CLICK message\nappend region + modifiers"]
Reviews (2): Last reviewed commit: "Make private" | Re-trigger Greptile
This change splits
MetaEventTranslator::translateGameMessage()into smaller functions for better maintainability.Logically it should function the same.
TODO