From 9f668e20db77508965a12cc7c904ccd6d4e17b5a Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Tue, 15 Aug 2023 23:44:37 +0300 Subject: [PATCH] GameContext::OnMessage: Move the check for World.Paused into OnSetTeam 1. Regardless of the pause the message is CL_SETTEAM and there is no reason to match it against other messages. 2. Another implementation can save the wanted team and apply it later. --- src/game/server/gamecontext.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 1f087368b..86cfaace6 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -1936,7 +1936,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) OnCallVoteNetMessage(static_cast(pRawMsg), ClientID); else if(MsgID == NETMSGTYPE_CL_VOTE) OnVoteNetMessage(static_cast(pRawMsg), ClientID); - else if(MsgID == NETMSGTYPE_CL_SETTEAM && !m_World.m_Paused) + else if(MsgID == NETMSGTYPE_CL_SETTEAM) OnSetTeamNetMessage(static_cast(pRawMsg), ClientID); else if(MsgID == NETMSGTYPE_CL_ISDDNETLEGACY) { @@ -2656,6 +2656,9 @@ void CGameContext::OnVoteNetMessage(const CNetMsg_Cl_Vote *pMsg, int ClientID) void CGameContext::OnSetTeamNetMessage(const CNetMsg_Cl_SetTeam *pMsg, int ClientID) { + if(m_World.m_Paused) + return; + CPlayer *pPlayer = m_apPlayers[ClientID]; if(pPlayer->GetTeam() == pMsg->m_Team || (g_Config.m_SvSpamprotection && pPlayer->m_LastSetTeam && pPlayer->m_LastSetTeam + Server()->TickSpeed() * g_Config.m_SvTeamChangeDelay > Server()->Tick()))