Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ class GameMessage : public MemoryPoolObject
MSG_CREATE_FORMATION, ///< Creates a formation.
MSG_LOGIC_CRC, ///< CRC from the logic passed around in a network game :)
MSG_SET_MINE_CLEARING_DETAIL, ///< CRC from the logic passed around in a network game :)
MSG_ENABLE_RETALIATION_MODE, ///< Turn retaliation mode on or off for the specified player.
MSG_ENABLE_RETALIATION_MODE, ///< Turn retaliation mode on or off.

MSG_BEGIN_DEBUG_NETWORK_MESSAGES = 1900, ///< network messages that exist only in debug/internal builds. all grouped separately.

Expand Down
2 changes: 2 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,9 @@ void Player::update()
GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_ENABLE_RETALIATION_MODE );
if( msg )
{
#if RETAIL_COMPATIBLE_CRC
msg->appendIntegerArgument( getPlayerIndex() );
#endif
msg->appendBooleanArgument( TheGlobalData->m_clientRetaliationModeEnabled );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,15 +632,26 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )

case GameMessage::MSG_ENABLE_RETALIATION_MODE:
{
#if RETAIL_COMPATIBLE_CRC
//Logically turns on or off retaliation mode for a specified player.
Int playerIndex = msg->getArgument( 0 )->integer;
Bool enableRetaliation = msg->getArgument( 1 )->boolean;
const Int playerIndex = msg->getArgument( 0 )->integer;
const Bool enableRetaliation = msg->getArgument( 1 )->boolean;

Player *player = ThePlayerList->getNthPlayer( playerIndex );
if( player )
{
DEBUG_ASSERTCRASH(player == thisPlayer,
("Retaliation mode of player '%ls' was illegally set by player '%ls'. Before: '%d', after: '%d'.",
player->getPlayerDisplayName().str(), thisPlayer->getPlayerDisplayName().str(),
player->isLogicalRetaliationModeEnabled(), enableRetaliation) );

player->setLogicalRetaliationModeEnabled( enableRetaliation );
}
#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 );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect this will cause mismatch now.

Retaliation needs to be network synced otherwise the Unit behavior will mismatch between clients.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that in #2383 if you like.

#endif
break;
}

Expand Down
Loading