mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Use server global variables for client loops
Use server global variables for determining the num clients to loop over. This is cheaper and better than always looping over MAX_PLAYERS.
This commit is contained in:
parent
6b23570beb
commit
f319fc0846
@ -83,7 +83,7 @@ int CServer::GetNumClients(void) const
|
||||
// Purpose: Initializes a CSVClient for a new net connection. This will only be called
|
||||
// once for a player each game, not once for each level change.
|
||||
// Input : *pServer -
|
||||
// *pInpacket -
|
||||
// *pChallenge -
|
||||
// Output : pointer to client instance on success, nullptr on failure
|
||||
//---------------------------------------------------------------------------------
|
||||
CClient* CServer::ConnectClient(CServer* pServer, user_creds_s* pChallenge)
|
||||
|
@ -76,7 +76,7 @@ void SV_CheckForBan(const BannedVec_t* pBannedVec /*= nullptr*/)
|
||||
Assert(ThreadInMainThread());
|
||||
BannedVec_t bannedVec;
|
||||
|
||||
for (int c = 0; c < MAX_PLAYERS; c++) // Loop through all possible client instances.
|
||||
for (int c = 0; c < g_ServerGlobalVariables->m_nMaxClients; c++) // Loop through all possible client instances.
|
||||
{
|
||||
CClient* pClient = g_pClient->GetClient(c);
|
||||
if (!pClient)
|
||||
|
@ -19,7 +19,7 @@ void Physics_RunBotSimulation(bool bSimulating)
|
||||
if (!sv_simulateBots->GetBool())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||
for (int i = 0; i < g_ServerGlobalVariables->m_nMaxClients; i++)
|
||||
{
|
||||
CClient* pClient = g_pClient->GetClient(i);
|
||||
if (!pClient)
|
||||
|
@ -294,7 +294,7 @@ void CBanSystem::AuthorPlayerByName(const char* playerName, const bool shouldBan
|
||||
if (!reason)
|
||||
reason = shouldBan ? "Banned from server" : "Kicked from server";
|
||||
|
||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||
for (int i = 0; i < g_ServerGlobalVariables->m_nMaxClients; i++)
|
||||
{
|
||||
CClient* pClient = g_pClient->GetClient(i);
|
||||
if (!pClient)
|
||||
@ -347,7 +347,7 @@ void CBanSystem::AuthorPlayerById(const char* playerHandle, const bool shouldBan
|
||||
if (!reason)
|
||||
reason = shouldBan ? "Banned from server" : "Kicked from server";
|
||||
|
||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||
for (int i = 0; i < g_ServerGlobalVariables->m_nMaxClients; i++)
|
||||
{
|
||||
CClient* pClient = g_pClient->GetClient(i);
|
||||
if (!pClient)
|
||||
|
Loading…
x
Reference in New Issue
Block a user