mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #3930
3930: Still allow lock/unlock/practice while sv_chat_initial_delay is set r=Jupeyy a=def- Not sure if we should just allow them whenever someone is muted Fixes #3929 <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
0393ac0f88
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue