fix(logic): Improve validation of MSG_NEW_GAME in GameLogicDispatch#2440
Conversation
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | Adds guard against MSG_NEW_GAME when game is in invalid state, but calls isClearingGameData() and isLoadingMap() which don't exist in the Generals GameLogic class — will cause a compile error when RETAIL_COMPATIBLE_CRC=0. |
| GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | Same guard added to Zero Hour (GeneralsMD); all three methods (isInGame, isClearingGameData, isLoadingMap) are properly declared in the GeneralsMD GameLogic header — no issues. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[MSG_NEW_GAME received] --> B{RETAIL_COMPATIBLE_CRC == 0?}
B -- No --> E[Process MSG_NEW_GAME normally]
B -- Yes --> C{"isInGame() ||\nisClearingGameData() ||\nisLoadingMap()"}
C -- true --> D[DEBUG_CRASH + break\nMessage silently dropped]
C -- false --> E
E --> F[prepareNewGame]
F --> G[startNewGame]
Prompt To Fix All With AI
This is a comment left during a code review.
Path: Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Line: 417-422
Comment:
**Missing methods in Generals GameLogic**
`isClearingGameData()` and `isLoadingMap()` are not declared in `Generals/Code/GameEngine/Include/GameLogic/GameLogic.h`. The Generals version only has `isLoadingGame()`. This means that when `RETAIL_COMPATIBLE_CRC` is set to `0`, the Generals build will fail to compile.
The GeneralsMD (Zero Hour) version correctly declares both methods (`isLoadingMap()` on line 189 and `isClearingGameData()` on line 191 of its `GameLogic.h`), but the vanilla Generals version does not have these equivalents.
This appears to be tracked by the open PR Todo item ("Replicate in Generals"), but as-is the `Generals` build is broken when `RETAIL_COMPATIBLE_CRC=0`.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: b5d35b3
Is this necessary? I was under the impression that it's not possible to recover from the DC bug. |
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Show resolved
Hide resolved
The DC bug is game ending, but once someone leaves the other guy wins, and that game may then carry on for some more frames and be recorded in the replay. Since this PR changes something there it may then mismatch right at the end, I didn't test specifically though. |
xezon
left a comment
There was a problem hiding this comment.
Makes logical sense.
I suggest test all game modes and verify they all properly launch.
Comment can be written better.
Needs to be replicated in Generals.
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Outdated
Show resolved
Hide resolved
Think I got all of them except for Generals challenge and WOL (see ticket description). I could try spinning up x64's server code |
|
Can ignore the WOL for now. |
This should be an acceptable mismatch imho. The game has basically ended. |
The concern was that we would be wasting time on investigating replay mismatches due to anti-cheat fixes, see #2408. If you don't think that concern applies here then there will be no need for the RETAIL_COMPATIBLE_CRC |
|
Can you fix the Generals compile error? Edit: Nevermind, I see you did a unify first. |
|
Is this ready now? |
This prevents a possible issue where the game gets stuck in the disconnect screen ("dc bug") when making a call to MSG_NEW_GAME when the game is not ready for it.
Tested with local multiplayer match, skirmish, savegame, replay, campaign, generals challeng. 1k replays passed.
Moved behind RETAIL_COMPATIBLE_CRC in the case of any replays that have a forced dc bug.
Todo