Skip to content

Commit 1c077c5

Browse files
fix(logic): Improve handling of ENABLE_RETALIATION_MODE in GameLogicDispatch (#2408)
1 parent bacee75 commit 1c077c5

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ class GameMessage : public MemoryPoolObject
600600
MSG_CREATE_FORMATION, ///< Creates a formation.
601601
MSG_LOGIC_CRC, ///< CRC from the logic passed around in a network game :)
602602
MSG_SET_MINE_CLEARING_DETAIL, ///< CRC from the logic passed around in a network game :)
603-
MSG_ENABLE_RETALIATION_MODE, ///< Turn retaliation mode on or off for the specified player.
603+
MSG_ENABLE_RETALIATION_MODE, ///< Turn retaliation mode on or off.
604604

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

GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,9 @@ void Player::update()
707707
GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_ENABLE_RETALIATION_MODE );
708708
if( msg )
709709
{
710+
#if RETAIL_COMPATIBLE_CRC
710711
msg->appendIntegerArgument( getPlayerIndex() );
712+
#endif
711713
msg->appendBooleanArgument( TheGlobalData->m_clientRetaliationModeEnabled );
712714
}
713715
}

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,15 +632,26 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData )
632632

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

639640
Player *player = ThePlayerList->getNthPlayer( playerIndex );
640641
if( player )
641642
{
643+
DEBUG_ASSERTCRASH(player == thisPlayer,
644+
("Retaliation mode of player '%ls' was illegally set by player '%ls'. Before: '%d', after: '%d'.",
645+
player->getPlayerDisplayName().str(), thisPlayer->getPlayerDisplayName().str(),
646+
player->isLogicalRetaliationModeEnabled(), enableRetaliation) );
647+
642648
player->setLogicalRetaliationModeEnabled( enableRetaliation );
643649
}
650+
#else
651+
// TheSuperHackers @fix stephanmeesters 08/03/2026 Ensure that players can only set their own retaliation mode.
652+
const Bool enableRetaliation = msg->getArgument( 0 )->boolean;
653+
thisPlayer->setLogicalRetaliationModeEnabled( enableRetaliation );
654+
#endif
644655
break;
645656
}
646657

0 commit comments

Comments
 (0)