diff --git a/src/engine/client.h b/src/engine/client.h index 172dabb32..7d858a19c 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -160,12 +160,12 @@ public: virtual void SnapSetStaticsize(int ItemType, int Size) = 0; virtual int SendMsg(CMsgPacker *pMsg, int Flags) = 0; - virtual int SendMsgExY(CMsgPacker *pMsg, int Flags, bool System=true, int NetClient=1) = 0; + virtual int SendMsgY(CMsgPacker *pMsg, int Flags, int NetClient=1) = 0; template int SendPackMsg(T *pMsg, int Flags) { - CMsgPacker Packer(pMsg->MsgID()); + CMsgPacker Packer(pMsg->MsgID(), false); if(pMsg->Pack(&Packer)) return -1; return SendMsg(&Packer, Flags); diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 06407d359..14bcd8e34 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -362,11 +362,6 @@ CClient::CClient() : m_DemoPlayer(&m_SnapshotDelta) // ----- send functions ----- int CClient::SendMsg(CMsgPacker *pMsg, int Flags) -{ - return SendMsgEx(pMsg, Flags, false); -} - -int CClient::SendMsgEx(CMsgPacker *pMsg, int Flags, bool System) { CNetChunk Packet; @@ -374,21 +369,10 @@ int CClient::SendMsgEx(CMsgPacker *pMsg, int Flags, bool System) return 0; mem_zero(&Packet, sizeof(CNetChunk)); - Packet.m_ClientID = 0; Packet.m_pData = pMsg->Data(); Packet.m_DataSize = pMsg->Size(); - // HACK: modify the message id in the packet and store the system flag - if(*((unsigned char*)Packet.m_pData) == 1 && System && Packet.m_DataSize == 1) - { - dbg_break(); - } - - *((unsigned char*)Packet.m_pData) <<= 1; - if(System) - *((unsigned char*)Packet.m_pData) |= 1; - if(Flags&MSGFLAG_VITAL) Packet.m_Flags |= NETSENDFLAG_VITAL; if(Flags&MSGFLAG_FLUSH) @@ -411,23 +395,23 @@ int CClient::SendMsgEx(CMsgPacker *pMsg, int Flags, bool System) void CClient::SendInfo() { - CMsgPacker Msg(NETMSG_INFO); + CMsgPacker Msg(NETMSG_INFO, true); Msg.AddString(GameClient()->NetVersion(), 128); Msg.AddString(m_Password, 128); - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); + SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); } void CClient::SendEnterGame() { - CMsgPacker Msg(NETMSG_ENTERGAME); - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); + CMsgPacker Msg(NETMSG_ENTERGAME, true); + SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); } void CClient::SendReady() { - CMsgPacker Msg(NETMSG_READY); - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); + CMsgPacker Msg(NETMSG_READY, true); + SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); } void CClient::SendMapRequest() @@ -435,9 +419,9 @@ void CClient::SendMapRequest() if(m_MapdownloadFile) io_close(m_MapdownloadFile); m_MapdownloadFile = Storage()->OpenFile(m_aMapdownloadFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE); - CMsgPacker Msg(NETMSG_REQUEST_MAP_DATA); + CMsgPacker Msg(NETMSG_REQUEST_MAP_DATA, true); Msg.AddInt(m_MapdownloadChunk); - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); + SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); } void CClient::RconAuth(const char *pName, const char *pPassword) @@ -448,18 +432,18 @@ void CClient::RconAuth(const char *pName, const char *pPassword) if(pPassword != m_RconPassword) str_copy(m_RconPassword, pPassword, sizeof(m_RconPassword)); - CMsgPacker Msg(NETMSG_RCON_AUTH); + CMsgPacker Msg(NETMSG_RCON_AUTH, true); Msg.AddString(pName, 32); Msg.AddString(pPassword, 32); Msg.AddInt(1); - SendMsgEx(&Msg, MSGFLAG_VITAL); + SendMsg(&Msg, MSGFLAG_VITAL); } void CClient::Rcon(const char *pCmd) { - CMsgPacker Msg(NETMSG_RCON_CMD); + CMsgPacker Msg(NETMSG_RCON_CMD, true); Msg.AddString(pCmd, 256); - SendMsgEx(&Msg, MSGFLAG_VITAL); + SendMsg(&Msg, MSGFLAG_VITAL); } bool CClient::ConnectionProblems() @@ -469,16 +453,15 @@ bool CClient::ConnectionProblems() void CClient::DirectInput(int *pInput, int Size) { - int i; - CMsgPacker Msg(NETMSG_INPUT); + CMsgPacker Msg(NETMSG_INPUT, true); Msg.AddInt(m_AckGameTick[g_Config.m_ClDummy]); Msg.AddInt(m_PredTick[g_Config.m_ClDummy]); Msg.AddInt(Size); - for(i = 0; i < Size/4; i++) + for(int i = 0; i < Size/4; i++) Msg.AddInt(pInput[i]); - SendMsgEx(&Msg, 0); + SendMsg(&Msg, 0); } void CClient::SendInput() @@ -508,7 +491,7 @@ void CClient::SendInput() if(Size) { // pack input - CMsgPacker Msg(NETMSG_INPUT); + CMsgPacker Msg(NETMSG_INPUT, true); Msg.AddInt(m_AckGameTick[i]); Msg.AddInt(m_PredTick[i]); Msg.AddInt(Size); @@ -524,7 +507,7 @@ void CClient::SendInput() m_CurrentInput[i]++; m_CurrentInput[i] %= 200; - SendMsgExY(&Msg, MSGFLAG_FLUSH, true, i); + SendMsgY(&Msg, MSGFLAG_FLUSH, i); // ugly workaround for dummy. we need to send input with dummy to prevent // prediction time resets. but if we do it too often, then it's // impossible to use grenade with frozen dummy that gets hammered... @@ -838,7 +821,7 @@ int CClient::GetCurrentRaceTime() return (GameTick() - GameClient()->GetLastRaceTick()) / 50; } -int CClient::SendMsgExY(CMsgPacker *pMsg, int Flags, bool System, int NetClient) +int CClient::SendMsgY(CMsgPacker *pMsg, int Flags, int NetClient) { CNetChunk Packet; @@ -848,16 +831,6 @@ int CClient::SendMsgExY(CMsgPacker *pMsg, int Flags, bool System, int NetClient) Packet.m_pData = pMsg->Data(); Packet.m_DataSize = pMsg->Size(); - // HACK: modify the message id in the packet and store the system flag - if(*((unsigned char*)Packet.m_pData) == 1 && System && Packet.m_DataSize == 1) - { - dbg_break(); - } - - *((unsigned char*)Packet.m_pData) <<= 1; - if(System) - *((unsigned char*)Packet.m_pData) |= 1; - if(Flags&MSGFLAG_VITAL) Packet.m_Flags |= NETSENDFLAG_VITAL; if(Flags&MSGFLAG_FLUSH) @@ -1541,7 +1514,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket) { CUnpacker Unpacker; Unpacker.Reset(pPacket->m_pData, pPacket->m_DataSize); - CMsgPacker Packer(NETMSG_EX); + CMsgPacker Packer(NETMSG_EX, true); // unpack msgid and system flag int Msg; @@ -1555,7 +1528,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket) } else if(Result == UNPACKMESSAGE_ANSWER) { - SendMsgEx(&Packer, MSGFLAG_VITAL, true); + SendMsg(&Packer, MSGFLAG_VITAL); } if(Sys) @@ -1709,9 +1682,9 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket) // request new chunk m_MapdownloadChunk++; - CMsgPacker Msg(NETMSG_REQUEST_MAP_DATA); + CMsgPacker Msg(NETMSG_REQUEST_MAP_DATA, true); Msg.AddInt(m_MapdownloadChunk); - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); + SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH); if(g_Config.m_Debug) { @@ -1727,8 +1700,8 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket) } else if(Msg == NETMSG_PING) { - CMsgPacker Msg(NETMSG_PING_REPLY); - SendMsgEx(&Msg, 0); + CMsgPacker Msg(NETMSG_PING_REPLY, true); + SendMsg(&Msg, 0); } else if((pPacket->m_Flags&NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_RCON_CMD_ADD) { @@ -1992,9 +1965,9 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket) char aBuf[256]; str_format(aBuf, sizeof(aBuf), "/timeout %s", m_aTimeoutCodes[g_Config.m_ClDummy]); Msg.m_pMessage = aBuf; - CMsgPacker Packer(Msg.MsgID()); + CMsgPacker Packer(Msg.MsgID(), true); Msg.Pack(&Packer); - SendMsgExY(&Packer, MSGFLAG_VITAL, false, g_Config.m_ClDummy); + SendMsgY(&Packer, MSGFLAG_VITAL, g_Config.m_ClDummy); } } @@ -2027,7 +2000,7 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket) { CUnpacker Unpacker; Unpacker.Reset(pPacket->m_pData, pPacket->m_DataSize); - CMsgPacker Packer(NETMSG_EX); + CMsgPacker Packer(NETMSG_EX, true); // unpack msgid and system flag int Msg; @@ -2041,7 +2014,7 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket) } else if(Result == UNPACKMESSAGE_ANSWER) { - SendMsgEx(&Packer, MSGFLAG_VITAL, true); + SendMsg(&Packer, MSGFLAG_VITAL); } if(Sys) @@ -2942,24 +2915,24 @@ void CClient::Run() m_DummySendConnInfo = false; // send client info - CMsgPacker MsgInfo(NETMSG_INFO); + CMsgPacker MsgInfo(NETMSG_INFO, true); MsgInfo.AddString(GameClient()->NetVersion(), 128); MsgInfo.AddString(m_Password, 128); - SendMsgExY(&MsgInfo, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1); + SendMsgY(&MsgInfo, MSGFLAG_VITAL|MSGFLAG_FLUSH, 1); // update netclient m_NetClient[CLIENT_DUMMY].Update(); // send ready - CMsgPacker MsgReady(NETMSG_READY); - SendMsgExY(&MsgReady, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1); + CMsgPacker MsgReady(NETMSG_READY, true); + SendMsgY(&MsgReady, MSGFLAG_VITAL|MSGFLAG_FLUSH, 1); // startinfo GameClient()->SendDummyInfo(true); // send enter game an finish the connection - CMsgPacker MsgEnter(NETMSG_ENTERGAME); - SendMsgExY(&MsgEnter, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1); + CMsgPacker MsgEnter(NETMSG_ENTERGAME, true); + SendMsgY(&MsgEnter, MSGFLAG_VITAL|MSGFLAG_FLUSH, 1); } // update input @@ -3204,8 +3177,8 @@ void CClient::Con_Ping(IConsole::IResult *pResult, void *pUserData) { CClient *pSelf = (CClient *)pUserData; - CMsgPacker Msg(NETMSG_PING); - pSelf->SendMsgEx(&Msg, 0); + CMsgPacker Msg(NETMSG_PING, true); + pSelf->SendMsg(&Msg, 0); pSelf->m_PingStartTime = time_get(); } diff --git a/src/engine/client/client.h b/src/engine/client/client.h index 71e5f96d7..e0105ec30 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -250,9 +250,8 @@ public: // ----- send functions ----- virtual int SendMsg(CMsgPacker *pMsg, int Flags); - virtual int SendMsgExY(CMsgPacker *pMsg, int Flags, bool System=true, int NetClient=1); + virtual int SendMsgY(CMsgPacker *pMsg, int Flags, int NetClient=1); - int SendMsgEx(CMsgPacker *pMsg, int Flags, bool System=true); void SendInfo(); void SendEnterGame(); void SendReady(); diff --git a/src/engine/message.h b/src/engine/message.h index af8905fdd..75454c232 100644 --- a/src/engine/message.h +++ b/src/engine/message.h @@ -9,16 +9,16 @@ class CMsgPacker : public CPacker { public: - CMsgPacker(int Type) + CMsgPacker(int Type, bool System=false) { Reset(); if(Type < OFFSET_UUID) { - AddInt(Type); + AddInt((Type<<1)|(System?1:0)); } else { - AddInt(0); // NETMSG_EX, NETMSGTYPE_EX + AddInt((0<<1)|(System?1:0)); // NETMSG_EX, NETMSGTYPE_EX g_UuidManager.PackUuid(Type, this); } } diff --git a/src/engine/server.h b/src/engine/server.h index a386f47e7..394feee3c 100644 --- a/src/engine/server.h +++ b/src/engine/server.h @@ -100,7 +100,7 @@ public: template int SendPackMsgOne(T *pMsg, int Flags, int ClientID) { - CMsgPacker Packer(pMsg->MsgID()); + CMsgPacker Packer(pMsg->MsgID(), false); if(pMsg->Pack(&Packer)) return -1; return SendMsg(&Packer, Flags, ClientID); diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index cff4489b2..069387a27 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -621,27 +621,16 @@ int CServer::DistinctClientCount() } int CServer::SendMsg(CMsgPacker *pMsg, int Flags, int ClientID) -{ - return SendMsgEx(pMsg, Flags, ClientID, false); -} - -int CServer::SendMsgEx(CMsgPacker *pMsg, int Flags, int ClientID, bool System) { CNetChunk Packet; if(!pMsg) return -1; mem_zero(&Packet, sizeof(CNetChunk)); - Packet.m_ClientID = ClientID; Packet.m_pData = pMsg->Data(); Packet.m_DataSize = pMsg->Size(); - // HACK: modify the message id in the packet and store the system flag - *((unsigned char*)Packet.m_pData) <<= 1; - if(System) - *((unsigned char*)Packet.m_pData) |= 1; - if(Flags&MSGFLAG_VITAL) Packet.m_Flags |= NETSENDFLAG_VITAL; if(Flags&MSGFLAG_FLUSH) @@ -786,17 +775,17 @@ void CServer::DoSnapshot() if(NumPackets == 1) { - CMsgPacker Msg(NETMSG_SNAPSINGLE); + CMsgPacker Msg(NETMSG_SNAPSINGLE, true); Msg.AddInt(m_CurrentGameTick); Msg.AddInt(m_CurrentGameTick-DeltaTick); Msg.AddInt(Crc); Msg.AddInt(Chunk); Msg.AddRaw(&aCompData[n*MaxSize], Chunk); - SendMsgEx(&Msg, MSGFLAG_FLUSH, i, true); + SendMsg(&Msg, MSGFLAG_FLUSH, i); } else { - CMsgPacker Msg(NETMSG_SNAP); + CMsgPacker Msg(NETMSG_SNAP, true); Msg.AddInt(m_CurrentGameTick); Msg.AddInt(m_CurrentGameTick-DeltaTick); Msg.AddInt(NumPackets); @@ -804,16 +793,16 @@ void CServer::DoSnapshot() Msg.AddInt(Crc); Msg.AddInt(Chunk); Msg.AddRaw(&aCompData[n*MaxSize], Chunk); - SendMsgEx(&Msg, MSGFLAG_FLUSH, i, true); + SendMsg(&Msg, MSGFLAG_FLUSH, i); } } } else { - CMsgPacker Msg(NETMSG_SNAPEMPTY); + CMsgPacker Msg(NETMSG_SNAPEMPTY, true); Msg.AddInt(m_CurrentGameTick); Msg.AddInt(m_CurrentGameTick-DeltaTick); - SendMsgEx(&Msg, MSGFLAG_FLUSH, i, true); + SendMsg(&Msg, MSGFLAG_FLUSH, i); } } } @@ -970,9 +959,9 @@ int CServer::DelClientCallback(int ClientID, const char *pReason, void *pUser) void CServer::SendRconType(int ClientID, bool UsernameReq) { - CMsgPacker Msg(NETMSG_RCONTYPE); + CMsgPacker Msg(NETMSG_RCONTYPE, true); Msg.AddInt(UsernameReq); - SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL, ClientID); } void CServer::GetMapInfo(char *pMapName, int MapNameSize, int *pMapSize, SHA256_DIGEST *pMapSha256, int *pMapCrc) @@ -985,28 +974,28 @@ void CServer::GetMapInfo(char *pMapName, int MapNameSize, int *pMapSize, SHA256_ void CServer::SendCapabilities(int ClientID) { - CMsgPacker Msg(NETMSG_CAPABILITIES); + CMsgPacker Msg(NETMSG_CAPABILITIES, true); Msg.AddInt(SERVERCAP_CURVERSION); // version Msg.AddInt(SERVERCAPFLAG_DDNET | SERVERCAPFLAG_CHATTIMEOUTCODE); // flags - SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL, ClientID); } void CServer::SendMap(int ClientID) { { - CMsgPacker Msg(NETMSG_MAP_DETAILS); + CMsgPacker Msg(NETMSG_MAP_DETAILS, true); Msg.AddString(GetMapName(), 0); Msg.AddRaw(&m_CurrentMapSha256.data, sizeof(m_CurrentMapSha256.data)); Msg.AddInt(m_CurrentMapCrc); Msg.AddInt(m_CurrentMapSize); - SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL, ClientID); } { - CMsgPacker Msg(NETMSG_MAP_CHANGE); + CMsgPacker Msg(NETMSG_MAP_CHANGE, true); Msg.AddString(GetMapName(), 0); Msg.AddInt(m_CurrentMapCrc); Msg.AddInt(m_CurrentMapSize); - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID); } m_aClients[ClientID].m_NextMapChunk = 0; @@ -1028,13 +1017,13 @@ void CServer::SendMapData(int ClientID, int Chunk) Last = 1; } - CMsgPacker Msg(NETMSG_MAP_DATA); + CMsgPacker Msg(NETMSG_MAP_DATA, true); Msg.AddInt(Last); Msg.AddInt(m_CurrentMapCrc); Msg.AddInt(Chunk); Msg.AddInt(ChunkSize); Msg.AddRaw(&m_pCurrentMapData[Offset], ChunkSize); - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID); if(g_Config.m_Debug) { @@ -1046,15 +1035,15 @@ void CServer::SendMapData(int ClientID, int Chunk) void CServer::SendConnectionReady(int ClientID) { - CMsgPacker Msg(NETMSG_CON_READY); - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true); + CMsgPacker Msg(NETMSG_CON_READY, true); + SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID); } void CServer::SendRconLine(int ClientID, const char *pLine) { - CMsgPacker Msg(NETMSG_RCON_LINE); + CMsgPacker Msg(NETMSG_RCON_LINE, true); Msg.AddString(pLine, 512); - SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL, ClientID); } void CServer::SendRconLineAuthed(const char *pLine, void *pUser, bool Highlighted) @@ -1103,18 +1092,18 @@ void CServer::SendRconLineAuthed(const char *pLine, void *pUser, bool Highlighte void CServer::SendRconCmdAdd(const IConsole::CCommandInfo *pCommandInfo, int ClientID) { - CMsgPacker Msg(NETMSG_RCON_CMD_ADD); + CMsgPacker Msg(NETMSG_RCON_CMD_ADD, true); Msg.AddString(pCommandInfo->m_pName, IConsole::TEMPCMD_NAME_LENGTH); Msg.AddString(pCommandInfo->m_pHelp, IConsole::TEMPCMD_HELP_LENGTH); Msg.AddString(pCommandInfo->m_pParams, IConsole::TEMPCMD_PARAMS_LENGTH); - SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL, ClientID); } void CServer::SendRconCmdRem(const IConsole::CCommandInfo *pCommandInfo, int ClientID) { - CMsgPacker Msg(NETMSG_RCON_CMD_REM); + CMsgPacker Msg(NETMSG_RCON_CMD_REM, true); Msg.AddString(pCommandInfo->m_pName, 256); - SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL, ClientID); } void CServer::UpdateClientRconCommands() @@ -1137,7 +1126,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) int ClientID = pPacket->m_ClientID; CUnpacker Unpacker; Unpacker.Reset(pPacket->m_pData, pPacket->m_DataSize); - CMsgPacker Packer(NETMSG_EX); + CMsgPacker Packer(NETMSG_EX, true); // unpack msgid and system flag int Msg; @@ -1171,7 +1160,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) if(Result == UNPACKMESSAGE_ANSWER) { - SendMsgEx(&Packer, MSGFLAG_VITAL, ClientID, true); + SendMsg(&Packer, MSGFLAG_VITAL, ClientID); } if(Sys) @@ -1297,10 +1286,10 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) { int TimeLeft = ((TickStartTime(IntendedTick)-time_get())*1000) / time_freq(); - CMsgPacker Msg(NETMSG_INPUTTIMING); + CMsgPacker Msg(NETMSG_INPUTTIMING, true); Msg.AddInt(IntendedTick); Msg.AddInt(TimeLeft); - SendMsgEx(&Msg, 0, ClientID, true); + SendMsg(&Msg, 0, ClientID); } m_aClients[ClientID].m_LastInputTick = IntendedTick; @@ -1388,10 +1377,10 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) { if(m_aClients[ClientID].m_Authed != AuthLevel) { - CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS); + CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS, true); Msg.AddInt(1); //authed Msg.AddInt(1); //cmdlist - SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL, ClientID); m_aClients[ClientID].m_Authed = AuthLevel; // Keeping m_Authed around is unwise... m_aClients[ClientID].m_AuthKey = KeySlot; @@ -1451,8 +1440,8 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) } else if(Msg == NETMSG_PING) { - CMsgPacker Msg(NETMSG_PING_REPLY); - SendMsgEx(&Msg, 0, ClientID, true); + CMsgPacker Msg(NETMSG_PING_REPLY, true); + SendMsg(&Msg, 0, ClientID); } else { @@ -2855,10 +2844,10 @@ void CServer::ConchainConsoleOutputLevelUpdate(IConsole::IResult *pResult, void void CServer::LogoutClient(int ClientID, const char *pReason) { - CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS); + CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS, true); Msg.AddInt(0); //authed Msg.AddInt(0); //cmdlist - SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL, ClientID); m_aClients[ClientID].m_AuthTries = 0; m_aClients[ClientID].m_pRconCmdToSend = 0; diff --git a/src/engine/server/server.h b/src/engine/server/server.h index 9aec571b8..cee0009ef 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -269,7 +269,6 @@ public: int DistinctClientCount(); virtual int SendMsg(CMsgPacker *pMsg, int Flags, int ClientID); - int SendMsgEx(CMsgPacker *pMsg, int Flags, int ClientID, bool System); void DoSnapshot(); diff --git a/src/game/client/components/emoticon.cpp b/src/game/client/components/emoticon.cpp index b85f766bf..421dd862e 100644 --- a/src/game/client/components/emoticon.cpp +++ b/src/game/client/components/emoticon.cpp @@ -188,9 +188,9 @@ void CEmoticon::Emote(int Emoticon) if(g_Config.m_ClDummyCopyMoves) { - CMsgPacker Msg(NETMSGTYPE_CL_EMOTICON); + CMsgPacker Msg(NETMSGTYPE_CL_EMOTICON, false); Msg.AddInt(Emoticon); - Client()->SendMsgExY(&Msg, MSGFLAG_VITAL, false, !g_Config.m_ClDummy); + Client()->SendMsgY(&Msg, MSGFLAG_VITAL, !g_Config.m_ClDummy); } } diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 33f0c9b1e..1dcb3414c 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1471,17 +1471,17 @@ void CGameClient::OnNewSnapshot() if(!m_DDRaceMsgSent[0] && m_Snap.m_pLocalInfo) { - CMsgPacker Msg(NETMSGTYPE_CL_ISDDNET); + CMsgPacker Msg(NETMSGTYPE_CL_ISDDNET, false); Msg.AddInt(CLIENT_VERSIONNR); - Client()->SendMsgExY(&Msg, MSGFLAG_VITAL,false, 0); + Client()->SendMsgY(&Msg, MSGFLAG_VITAL, 0); m_DDRaceMsgSent[0] = true; } if(!m_DDRaceMsgSent[1] && m_Snap.m_pLocalInfo && Client()->DummyConnected()) { - CMsgPacker Msg(NETMSGTYPE_CL_ISDDNET); + CMsgPacker Msg(NETMSGTYPE_CL_ISDDNET, false); Msg.AddInt(CLIENT_VERSIONNR); - Client()->SendMsgExY(&Msg, MSGFLAG_VITAL,false, 1); + Client()->SendMsgY(&Msg, MSGFLAG_VITAL, 1); m_DDRaceMsgSent[1] = true; } @@ -1841,9 +1841,9 @@ void CGameClient::SendInfo(bool Start) Msg.m_UseCustomColor = g_Config.m_ClPlayerUseCustomColor; Msg.m_ColorBody = g_Config.m_ClPlayerColorBody; Msg.m_ColorFeet = g_Config.m_ClPlayerColorFeet; - CMsgPacker Packer(Msg.MsgID()); + CMsgPacker Packer(Msg.MsgID(), false); Msg.Pack(&Packer); - Client()->SendMsgExY(&Packer, MSGFLAG_VITAL, false, 0); + Client()->SendMsgY(&Packer, MSGFLAG_VITAL, 0); m_CheckInfo[0] = -1; } else @@ -1856,9 +1856,9 @@ void CGameClient::SendInfo(bool Start) Msg.m_UseCustomColor = g_Config.m_ClPlayerUseCustomColor; Msg.m_ColorBody = g_Config.m_ClPlayerColorBody; Msg.m_ColorFeet = g_Config.m_ClPlayerColorFeet; - CMsgPacker Packer(Msg.MsgID()); + CMsgPacker Packer(Msg.MsgID(), false); Msg.Pack(&Packer); - Client()->SendMsgExY(&Packer, MSGFLAG_VITAL, false, 0); + Client()->SendMsgY(&Packer, MSGFLAG_VITAL, 0); m_CheckInfo[0] = Client()->GameTickSpeed(); } } @@ -1875,9 +1875,9 @@ void CGameClient::SendDummyInfo(bool Start) Msg.m_UseCustomColor = g_Config.m_ClDummyUseCustomColor; Msg.m_ColorBody = g_Config.m_ClDummyColorBody; Msg.m_ColorFeet = g_Config.m_ClDummyColorFeet; - CMsgPacker Packer(Msg.MsgID()); + CMsgPacker Packer(Msg.MsgID(), false); Msg.Pack(&Packer); - Client()->SendMsgExY(&Packer, MSGFLAG_VITAL, false, 1); + Client()->SendMsgY(&Packer, MSGFLAG_VITAL, 1); m_CheckInfo[1] = -1; } else @@ -1890,9 +1890,9 @@ void CGameClient::SendDummyInfo(bool Start) Msg.m_UseCustomColor = g_Config.m_ClDummyUseCustomColor; Msg.m_ColorBody = g_Config.m_ClDummyColorBody; Msg.m_ColorFeet = g_Config.m_ClDummyColorFeet; - CMsgPacker Packer(Msg.MsgID()); + CMsgPacker Packer(Msg.MsgID(), false); Msg.Pack(&Packer); - Client()->SendMsgExY(&Packer, MSGFLAG_VITAL,false, 1); + Client()->SendMsgY(&Packer, MSGFLAG_VITAL, 1); m_CheckInfo[1] = Client()->GameTickSpeed(); } } @@ -1904,8 +1904,8 @@ void CGameClient::SendKill(int ClientID) if(g_Config.m_ClDummyCopyMoves) { - CMsgPacker Msg(NETMSGTYPE_CL_KILL); - Client()->SendMsgExY(&Msg, MSGFLAG_VITAL, false, !g_Config.m_ClDummy); + CMsgPacker Msg(NETMSGTYPE_CL_KILL, false); + Client()->SendMsgY(&Msg, MSGFLAG_VITAL, !g_Config.m_ClDummy); } }