mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24:18 +00:00
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.
This commit is contained in:
parent
ce5371b038
commit
9f668e20db
|
@ -1936,7 +1936,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
|
|||
OnCallVoteNetMessage(static_cast<CNetMsg_Cl_CallVote *>(pRawMsg), ClientID);
|
||||
else if(MsgID == NETMSGTYPE_CL_VOTE)
|
||||
OnVoteNetMessage(static_cast<CNetMsg_Cl_Vote *>(pRawMsg), ClientID);
|
||||
else if(MsgID == NETMSGTYPE_CL_SETTEAM && !m_World.m_Paused)
|
||||
else if(MsgID == NETMSGTYPE_CL_SETTEAM)
|
||||
OnSetTeamNetMessage(static_cast<CNetMsg_Cl_SetTeam *>(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()))
|
||||
|
|
Loading…
Reference in a new issue