unify(gamemessage): Merge MessageStream, MetaEvent code#2756
Conversation
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Include/Common/MessageStream.h | Syncs new enum values from GeneralsMD: adds MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE, MSG_CHEAT_* block under _ALLOW_DEBUG_CHEATS_IN_RELEASE, new debug performance/audio entries, MSG_SABOTAGE_HINT. Several new lines use spaces instead of tabs, inconsistent with the rest of the file. |
| Generals/Code/GameEngine/Source/Common/MessageStream.cpp | Adds CASE_LABEL entries to getCommandTypeAsString() to match new enum values, including MSG_ENABLE_RETALIATION_MODE which was previously missing. Removes MSG_META_DEMO_INSTANT_QUIT from isInvalidDebugCommand (intentional, per reviewer approval). |
| Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp | Syncs lookup table entries to match new enum values. Adds a disabled debug key-logging block (dont_DUMP_ALL_KEYS_TO_LOG) and adds braces around the MSG_RAW_KEY_DOWN handler — logic is unchanged. Column alignment in the new _ALLOW_DEBUG_CHEATS_IN_RELEASE block is inconsistent. |
| GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h | Removes two trailing blank lines before MSG_END_NETWORK_MESSAGES. No functional change. |
| GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp | Removes a single blank line before the MetaMap loop — purely cosmetic, no functional change. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Raw Input / Key Event] --> B[MetaEventTranslator::translateGameMessage]
B --> C{MSG_RAW_KEY_DOWN?}
C -- Yes --> D[Record m_lastKeyDown\n+ optional DUMP_ALL_KEYS_TO_LOG]
C -- No --> E[Skip key record]
D --> F[Update m_lastModState]
E --> F
F --> G{Lookup MetaMap}
G --> H{isMessageUsable?}
H -- Yes --> I[Append meta message\nto TheMessageStream]
H -- No --> J[Skip]
I --> K{isInvalidDebugCommand?}
K -- Blocked --> L[Discard in multiplayer]
K -- Allowed --> M[Process GameMessage\ne.g. MSG_META_DEMO_INSTANT_QUIT\nnow allowed in MP Debug]
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
Generals/Code/GameEngine/Include/Common/MessageStream.h:275-304
**Mixed indentation in new enum entries**
Several newly added enum entries use 4 spaces for indentation while all surrounding entries use tabs. This creates visual inconsistency in the enum block. Affected lines: `MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE` (line 275), `MSG_CHEAT_RUNSCRIPT1` (line 285), and `MSG_CHEAT_TOGGLE_MESSAGE_TEXT` (line 304) should all be indented with a tab to match the rest of the file.
### Issue 2 of 3
Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp:190-213
**Inconsistent column alignment in cheat lookup table block**
The `_ALLOW_DEBUG_CHEATS_IN_RELEASE` block in `GameMessageMetaTypeNames[]` mixes tabs and spaces to reach the `GameMessage::` column, resulting in misaligned columns across entries. Per the project's style for data-oriented blocks, the value column should be consistently aligned. Compare entries like `"CHEAT_DESHROUD"` (uses spaces + trailing spaces) against `"CHEAT_RUNSCRIPT1"` (uses tabs). The same pattern appears for `"DEMO_SHOW_AUDIO_LOCATIONS"` and `"DEMO_SHOW_HEALTH"` around line 285 of the same file.
### Issue 3 of 3
Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp:56-62
**Disabled debug logging block left in production code**
`dont_DUMP_ALL_KEYS_TO_LOG` is defined immediately before the `#ifdef DUMP_ALL_KEYS_TO_LOG` block, meaning this debug key-logging code is permanently dead unless the `dont_` prefix is manually removed. The block brings in a `Keyboard.h` include and `DEBUG_LOG` output — worth confirming this scaffolding is intentionally retained rather than accidentally committed.
Reviews (2): Last reviewed commit: "unify(message): Merge MessageStream, Met..." | Re-trigger Greptile
|
@greptile re-review this pr and ignore the MSG_META_DEMO_INSTANT_QUIT change as the behavioural change is okay and brings the behaviour of generals in-line with zero hour. |
Mauller
left a comment
There was a problem hiding this comment.
looks good overall, only alignment issues that might want fixing in both games files.
This change merges code in MessageStream, MetaEvent.
There should be no logical change, except allowing MSG_META_DEMO_INSTANT_QUIT in Multiplayer Debug.