From 5000b248bb04cfa78570db69207a43130e519523 Mon Sep 17 00:00:00 2001 From: Learath Date: Mon, 13 Apr 2020 15:19:07 +0300 Subject: [PATCH] Fix things --- src/engine/server/server.cpp | 2 +- src/game/server/gamecontext.cpp | 60 ++++++++++++++---------------- src/game/server/gamecontroller.cpp | 2 - 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index e7c7067c2..89c4919fd 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1051,7 +1051,7 @@ void CServer::SendMap(int ClientID) Msg.AddInt(1024-128); Msg.AddRaw(m_CurrentMapSha256.data, sizeof(m_CurrentMapSha256.data)); } - SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true); + SendMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID); } m_aClients[ClientID].m_NextMapChunk = 0; diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index f06291777..e53f1ddb7 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -1110,48 +1110,45 @@ void CGameContext::OnClientEnter(int ClientID) Server()->ExpireServerInfo(); - // update client infos (others before local) - CMsgPacker NewClientInfoMsg(18 + 24); - NewClientInfoMsg.AddInt(ClientID); - NewClientInfoMsg.AddInt(0); // m_Local - NewClientInfoMsg.AddInt(m_apPlayers[ClientID]->GetTeam()); - NewClientInfoMsg.AddString(Server()->ClientName(ClientID), -1); - NewClientInfoMsg.AddString(Server()->ClientClan(ClientID), -1); - NewClientInfoMsg.AddInt(Server()->ClientCountry(ClientID)); - for(int p = 0; p < 6; p++) - { - NewClientInfoMsg.AddString("", -1); // m_apSkinPartNames - NewClientInfoMsg.AddInt(0); // m_aUseCustomColors - NewClientInfoMsg.AddInt(0); // m_aSkinPartColors - } - NewClientInfoMsg.AddInt(0); // m_Silent - + // update client infos (others before local) for(int i = 0; i < MAX_CLIENTS; ++i) { if(i == ClientID || !m_apPlayers[i] || !Server()->ClientIngame(i)) continue; - // new info for others - if(Server()->ClientIngame(i) && Server()->IsSixup(i)) + if(Server()->IsSixup(i)) + { + // new info for others + CMsgPacker NewClientInfoMsg(18 + 24); // NETMSGTYPE_SV_CLIENTINFO + NewClientInfoMsg.AddInt(ClientID); + NewClientInfoMsg.AddInt(0); // m_Local + NewClientInfoMsg.AddInt(m_apPlayers[ClientID]->GetTeam()); + NewClientInfoMsg.AddString(Server()->ClientName(ClientID), -1); + NewClientInfoMsg.AddString(Server()->ClientClan(ClientID), -1); + NewClientInfoMsg.AddInt(Server()->ClientCountry(ClientID)); + for(int p = 0; p < 6; p++) NewClientInfoMsg.AddString("", -1); + for(int p = 0; p < 6; p++) NewClientInfoMsg.AddInt(0); + for(int p = 0; p < 6; p++) NewClientInfoMsg.AddInt(0); + NewClientInfoMsg.AddInt(0); // m_Silent + Server()->SendMsg(&NewClientInfoMsg, MSGFLAG_VITAL|MSGFLAG_NORECORD, i); + } if(Server()->IsSixup(ClientID)) { // existing infos for new player - CMsgPacker ClientInfoMsg(18 + 24); + CMsgPacker ClientInfoMsg(18 + 24); // NETMSGTYPE_SV_CLIENTINFO ClientInfoMsg.AddInt(i); ClientInfoMsg.AddInt(0); // m_Local ClientInfoMsg.AddInt(m_apPlayers[i]->GetTeam()); ClientInfoMsg.AddString(Server()->ClientName(i), -1); ClientInfoMsg.AddString(Server()->ClientClan(i), -1); ClientInfoMsg.AddInt(Server()->ClientCountry(i)); - for(int p = 0; p < 6; p++) - { - ClientInfoMsg.AddString("", -1); // m_apSkinPartNames - ClientInfoMsg.AddInt(0); // m_aUseCustomColors - ClientInfoMsg.AddInt(0); // m_aSkinPartColors - } + for(int p = 0; p < 6; p++) ClientInfoMsg.AddString("", -1); + for(int p = 0; p < 6; p++) ClientInfoMsg.AddInt(0); + for(int p = 0; p < 6; p++) ClientInfoMsg.AddInt(0); ClientInfoMsg.AddInt(0); // m_Silent + Server()->SendMsg(&ClientInfoMsg, MSGFLAG_VITAL|MSGFLAG_NORECORD, ClientID); } } @@ -1159,20 +1156,19 @@ void CGameContext::OnClientEnter(int ClientID) // local info if(Server()->IsSixup(ClientID)) { - CMsgPacker SelfClientInfoMsg(18 + 24); + dbg_msg("debug", "sending local client"); + CMsgPacker SelfClientInfoMsg(18 + 24); // NETMSGTYPE_SV_CLIENTINFO SelfClientInfoMsg.AddInt(ClientID); SelfClientInfoMsg.AddInt(1); // m_Local SelfClientInfoMsg.AddInt(m_apPlayers[ClientID]->GetTeam()); SelfClientInfoMsg.AddString(Server()->ClientName(ClientID), -1); SelfClientInfoMsg.AddString(Server()->ClientClan(ClientID), -1); SelfClientInfoMsg.AddInt(Server()->ClientCountry(ClientID)); - for(int p = 0; p < 6; p++) - { - SelfClientInfoMsg.AddString("", -1); // m_apSkinPartNames - SelfClientInfoMsg.AddInt(0); // m_aUseCustomColors - SelfClientInfoMsg.AddInt(0); // m_aSkinPartColors - } + for(int p = 0; p < 6; p++) SelfClientInfoMsg.AddString("", -1); + for(int p = 0; p < 6; p++) SelfClientInfoMsg.AddInt(0); + for(int p = 0; p < 6; p++) SelfClientInfoMsg.AddInt(0); SelfClientInfoMsg.AddInt(0); // m_Silent + Server()->SendMsg(&SelfClientInfoMsg, MSGFLAG_VITAL|MSGFLAG_NORECORD, ClientID); } } diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index b6fd1b303..c7b1567e9 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -569,8 +569,6 @@ void IGameController::Snap(int SnappingClient) pGameData[1] = 0; // m_GameStateFlags pGameData[2] = 0; // m_GameStateEndTick } - - SnapFlags(SnappingClient); } int IGameController::GetAutoTeam(int NotThisID)