fix(logic): Improve handling of ENABLE_RETALIATION_MODE in GameLogicDispatch#2408
Conversation
|
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Show resolved
Hide resolved
|
I'm fine with the current code, but I do think either the comment could be more informative and / or there could be an assertion like |
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp
Show resolved
Hide resolved
Both this and #2380 are now under RETAIL_COMPATIBLE_CRC and debug logging was added. |
| #else | ||
| // TheSuperHackers @fix stephanmeesters 08/03/2026 Ensure that players can only set their own retaliation mode. | ||
| const Bool enableRetaliation = msg->getArgument( 0 )->boolean; | ||
| thisPlayer->setLogicalRetaliationModeEnabled( enableRetaliation ); |
There was a problem hiding this comment.
I expect this will cause mismatch now.
Retaliation needs to be network synced otherwise the Unit behavior will mismatch between clients.
There was a problem hiding this comment.
I did test it with local multiplayer multi-instance without issues.
The only effective change is to use the knowledge that a player can only change its own retaliation mode, so there is no apparent need to pass another player ID as message argument, as you can use the ID of the owner of the message (which is thisPlayer). This is also consistent with how it works in other message types
There was a problem hiding this comment.
Ok I understand now. I was confused by thisPlayer. I suggest make a follow up and call it msgPlayer, because thisPlayer makes it sounds a bit like the local player.
Simplifies the code and prevents other players from setting each others retaliation mode. Tested with 1k replays and with own replay where I swap the retaliation mode on both sides couple times and test with some combat.
Generals (not Zero Hour) does not have a retaliation mode
Null check of
thisPlayerwill be handled by #2383