From 29c95bc0a2262cab2ee1981af59c77f00c0a0077 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 23 Jun 2021 08:51:11 +0200 Subject: [PATCH] Still allow lock/unlock/practice while sv_chat_initial_delay is set Not sure if we should just allow them whenever someone is muted Fixes #3929 --- src/game/server/ddracechat.cpp | 6 +++--- src/game/server/gamecontext.cpp | 4 ++-- src/game/server/gamecontext.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index c1bf47254..2ba5e92c0 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -600,7 +600,7 @@ void CGameContext::ConPractice(IConsole::IResult *pResult, void *pUserData) if(!pPlayer) return; - if(pSelf->ProcessSpamProtection(pResult->m_ClientID)) + if(pSelf->ProcessSpamProtection(pResult->m_ClientID, false)) return; if(!g_Config.m_SvPractice) @@ -866,7 +866,7 @@ void CGameContext::ConLockTeam(IConsole::IResult *pResult, void *pUserData) return; } - if(pSelf->ProcessSpamProtection(pResult->m_ClientID)) + if(pSelf->ProcessSpamProtection(pResult->m_ClientID, false)) return; char aBuf[512]; @@ -904,7 +904,7 @@ void CGameContext::ConUnlockTeam(IConsole::IResult *pResult, void *pUserData) if(Team <= TEAM_FLOCK || Team >= TEAM_SUPER) return; - if(pSelf->ProcessSpamProtection(pResult->m_ClientID)) + if(pSelf->ProcessSpamProtection(pResult->m_ClientID, false)) return; pSelf->UnlockTeam(pResult->m_ClientID, Team); diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 15bb2fc9e..6b24a8dbe 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3733,7 +3733,7 @@ void CGameContext::SendRecord(int ClientID) } } -int CGameContext::ProcessSpamProtection(int ClientID) +int CGameContext::ProcessSpamProtection(int ClientID, bool RespectChatInitialDelay) { if(!m_apPlayers[ClientID]) return 0; @@ -3751,7 +3751,7 @@ int CGameContext::ProcessSpamProtection(int ClientID) Server()->GetClientAddr(ClientID, &Addr); int Muted = 0; - if(m_apPlayers[ClientID]->m_JoinTick > m_NonEmptySince + 10 * Server()->TickSpeed()) + if(m_apPlayers[ClientID]->m_JoinTick > m_NonEmptySince + 10 * Server()->TickSpeed() && RespectChatInitialDelay) Muted = (m_apPlayers[ClientID]->m_JoinTick + Server()->TickSpeed() * g_Config.m_SvChatInitialDelay - Server()->Tick()) / Server()->TickSpeed(); if(Muted <= 0) { diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index 5c189552a..5b071519b 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -274,7 +274,7 @@ public: // DDRace bool OnClientDDNetVersionKnown(int ClientID); virtual void FillAntibot(CAntibotRoundData *pData); - int ProcessSpamProtection(int ClientID); + int ProcessSpamProtection(int ClientID, bool RespectChatInitialDelay = true); int GetDDRaceTeam(int ClientID); // Describes the time when the first player joined the server. int64 m_NonEmptySince;