diff --git a/Core/GameEngine/Include/GameNetwork/NetCommandMsg.h b/Core/GameEngine/Include/GameNetwork/NetCommandMsg.h index caf2302bc9b..f68b8362bbf 100644 --- a/Core/GameEngine/Include/GameNetwork/NetCommandMsg.h +++ b/Core/GameEngine/Include/GameNetwork/NetCommandMsg.h @@ -113,6 +113,7 @@ class NetGameCommandMsg : public NetCommandMsgTgetType() > GameMessage::MSG_BEGIN_NETWORK_MESSAGES) && (msg->getType() < GameMessage::MSG_END_NETWORK_MESSAGES))) { - return TRUE; - } - return FALSE; +Bool Network::isMessageTypeWithinNetworkRange(GameMessage::Type type) { + return type > GameMessage::MSG_BEGIN_NETWORK_MESSAGES && type < GameMessage::MSG_END_NETWORK_MESSAGES; } /** @@ -464,7 +458,7 @@ void Network::GetCommandsFromCommandList() { GameMessage *next = nullptr; while (msg != nullptr) { next = msg->next(); - if (isTransferCommand(msg)) { // Is this something we should be sending to the other players? + if (isMessageTypeWithinNetworkRange(msg->getType())) { // Is this something we should be sending to the other players? if (m_localStatus == NETLOCALSTATUS_INGAME) { m_conMgr->sendLocalGameMessage(msg, getExecutionFrame()); } @@ -586,8 +580,19 @@ void Network::RelayCommandsToCommandList(UnsignedInt frame) { while (msg != nullptr) { NetCommandType cmdType = msg->getCommand()->getNetCommandType(); if (cmdType == NETCOMMANDTYPE_GAMECOMMAND) { - //DEBUG_LOG(("Network::RelayCommandsToCommandList - appending command %d of type %s to command list on frame %d", msg->getCommand()->getID(), ((NetGameCommandMsg *)msg->getCommand())->constructGameMessage()->getCommandAsString(), TheGameLogic->getFrame())); - TheCommandList->appendMessage(((NetGameCommandMsg *)msg->getCommand())->constructGameMessage()); + NetGameCommandMsg* gmsg = static_cast(msg->getCommand()); +#if RETAIL_COMPATIBLE_CRC + TheCommandList->appendMessage(gmsg->constructGameMessage()); +#else + // TheSuperHackers @fix stephanmeesters 14/05/2026 Verify accepted type of incoming game messages + if (isMessageTypeWithinNetworkRange(gmsg->getGameMessageType())) { + //DEBUG_LOG(("Network::RelayCommandsToCommandList - appending command %d of type %s to command list on frame %d", msg->getCommand()->getID(), gmsg->getCommandAsString(), TheGameLogic->getFrame())); + TheCommandList->appendMessage(gmsg->constructGameMessage()); + } else { + DEBUG_LOG(("Network::RelayCommandsToCommandList - rejecting game message from player %d of type %s, which is not a network type.", + gmsg->getPlayerID(), GameMessage::getCommandTypeAsString(gmsg->getGameMessageType()))); + } +#endif } else { processFrameSynchronizedNetCommand(msg); }