Don't count (connecting) players for voting

This commit is contained in:
def 2023-01-02 11:10:05 +01:00
parent f0d2b9ab69
commit 39b34bf40c
2 changed files with 5 additions and 3 deletions

View file

@ -702,7 +702,8 @@ int CServer::DistinctClientCount() const
int ClientCount = 0;
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(m_aClients[i].m_State != CClient::STATE_EMPTY)
// connecting clients with spoofed ips can clog slots without being ingame
if(ClientIngame(i))
{
ClientCount++;
for(int j = 0; j < i; j++)

View file

@ -930,7 +930,7 @@ void CGameContext::OnTick()
continue;
// connecting clients with spoofed ips can clog slots without being ingame
if(((CServer *)Server())->m_aClients[i].m_State != CServer::CClient::STATE_INGAME)
if(!Server()->ClientIngame(i))
continue;
// don't count votes by blacklisted clients
@ -1507,7 +1507,8 @@ void CGameContext::OnClientConnected(int ClientID, void *pData)
bool Empty = true;
for(auto &pPlayer : m_apPlayers)
{
if(pPlayer)
// connecting clients with spoofed ips can clog slots without being ingame
if(pPlayer && Server()->ClientIngame(pPlayer->GetCID()))
{
Empty = false;
break;