mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
fixed sv_max_client usage
This commit is contained in:
parent
9a03989e84
commit
8e0ce38e29
|
@ -25,6 +25,7 @@ public:
|
|||
int Tick() const { return m_CurrentGameTick; }
|
||||
int TickSpeed() const { return m_TickSpeed; }
|
||||
|
||||
virtual int MaxClients() const = 0;
|
||||
virtual const char *ClientName(int ClientID) = 0;
|
||||
virtual const char *ClientClan(int ClientID) = 0;
|
||||
virtual int ClientCountry(int ClientID) = 0;
|
||||
|
|
|
@ -390,6 +390,11 @@ bool CServer::ClientIngame(int ClientID)
|
|||
return ClientID >= 0 && ClientID < MAX_CLIENTS && m_aClients[ClientID].m_State == CServer::CClient::STATE_INGAME;
|
||||
}
|
||||
|
||||
int CServer::MaxClients() const
|
||||
{
|
||||
return m_NetServer.MaxClients();
|
||||
}
|
||||
|
||||
int CServer::SendMsg(CMsgPacker *pMsg, int Flags, int ClientID)
|
||||
{
|
||||
return SendMsgEx(pMsg, Flags, ClientID, false);
|
||||
|
|
|
@ -163,6 +163,7 @@ public:
|
|||
const char *ClientClan(int ClientID);
|
||||
int ClientCountry(int ClientID);
|
||||
bool ClientIngame(int ClientID);
|
||||
int MaxClients() const;
|
||||
|
||||
virtual int SendMsg(CMsgPacker *pMsg, int Flags, int ClientID);
|
||||
int SendMsgEx(CMsgPacker *pMsg, int Flags, int ClientID, bool System);
|
||||
|
|
|
@ -317,7 +317,7 @@ public:
|
|||
// status requests
|
||||
NETADDR ClientAddr(int ClientID) const { return m_aSlots[ClientID].m_Connection.PeerAddress(); }
|
||||
NETSOCKET Socket() const { return m_Socket; }
|
||||
int NetType() { return m_Socket.type; }
|
||||
int NetType() const { return m_Socket.type; }
|
||||
int MaxClients() const { return m_MaxClients; }
|
||||
|
||||
//
|
||||
|
|
|
@ -802,7 +802,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
|
|||
else
|
||||
{
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "Only %d active players are allowed", g_Config.m_SvMaxClients-g_Config.m_SvSpectatorSlots);
|
||||
str_format(aBuf, sizeof(aBuf), "Only %d active players are allowed", Server()->MaxClients()-g_Config.m_SvSpectatorSlots);
|
||||
SendBroadcast(aBuf, ClientID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -595,7 +595,7 @@ bool IGameController::CanJoinTeam(int Team, int NotThisID)
|
|||
}
|
||||
}
|
||||
|
||||
return (aNumplayers[0] + aNumplayers[1]) < g_Config.m_SvMaxClients-g_Config.m_SvSpectatorSlots;
|
||||
return (aNumplayers[0] + aNumplayers[1]) < Server()->MaxClients()-g_Config.m_SvSpectatorSlots;
|
||||
}
|
||||
|
||||
bool IGameController::CheckTeamBalance()
|
||||
|
|
Loading…
Reference in a new issue