fixed sv_max_client usage

This commit is contained in:
oy 2011-12-04 16:51:33 +01:00
parent 9a03989e84
commit 8e0ce38e29
6 changed files with 10 additions and 3 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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; }
//

View file

@ -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);
}
}

View file

@ -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()