mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
Don't count (connecting) players for voting
This commit is contained in:
parent
f0d2b9ab69
commit
39b34bf40c
|
@ -702,7 +702,8 @@ int CServer::DistinctClientCount() const
|
||||||
int ClientCount = 0;
|
int ClientCount = 0;
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
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++;
|
ClientCount++;
|
||||||
for(int j = 0; j < i; j++)
|
for(int j = 0; j < i; j++)
|
||||||
|
|
|
@ -930,7 +930,7 @@ void CGameContext::OnTick()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// connecting clients with spoofed ips can clog slots without being ingame
|
// 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;
|
continue;
|
||||||
|
|
||||||
// don't count votes by blacklisted clients
|
// don't count votes by blacklisted clients
|
||||||
|
@ -1507,7 +1507,8 @@ void CGameContext::OnClientConnected(int ClientID, void *pData)
|
||||||
bool Empty = true;
|
bool Empty = true;
|
||||||
for(auto &pPlayer : m_apPlayers)
|
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;
|
Empty = false;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue