mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Make it less likely that antibot message is sent from random tees
Instead of sending the message from the first client which is not ingame, choose the first client which is fully empty, to make it less likely that the message is sent from a currently connecting client.
This commit is contained in:
parent
6d3bd36877
commit
be98c17738
|
@ -55,6 +55,7 @@ public:
|
|||
virtual const char *ClientName(int ClientID) const = 0;
|
||||
virtual const char *ClientClan(int ClientID) const = 0;
|
||||
virtual int ClientCountry(int ClientID) const = 0;
|
||||
virtual bool ClientEmpty(int ClientID) const = 0;
|
||||
virtual bool ClientIngame(int ClientID) const = 0;
|
||||
virtual bool ClientAuthed(int ClientID) const = 0;
|
||||
virtual bool GetClientInfo(int ClientID, CClientInfo *pInfo) const = 0;
|
||||
|
|
|
@ -646,6 +646,11 @@ int CServer::ClientCountry(int ClientID) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool CServer::ClientEmpty(int ClientID) const
|
||||
{
|
||||
return ClientID >= 0 && ClientID < MAX_CLIENTS && m_aClients[ClientID].m_State == CServer::CClient::STATE_EMPTY;
|
||||
}
|
||||
|
||||
bool CServer::ClientIngame(int ClientID) const
|
||||
{
|
||||
return ClientID >= 0 && ClientID < MAX_CLIENTS && m_aClients[ClientID].m_State == CServer::CClient::STATE_INGAME;
|
||||
|
|
|
@ -298,6 +298,7 @@ public:
|
|||
const char *ClientName(int ClientID) const override;
|
||||
const char *ClientClan(int ClientID) const override;
|
||||
int ClientCountry(int ClientID) const override;
|
||||
bool ClientEmpty(int ClientID) const override;
|
||||
bool ClientIngame(int ClientID) const override;
|
||||
bool ClientAuthed(int ClientID) const override;
|
||||
int Port() const override;
|
||||
|
|
|
@ -1521,7 +1521,7 @@ void CGameContext::OnClientEnter(int ClientID)
|
|||
int Empty = -1;
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(!Server()->ClientIngame(i))
|
||||
if(Server()->ClientEmpty(i))
|
||||
{
|
||||
Empty = i;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue