diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index aa32aab0..e4b3c687 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -47,9 +47,7 @@ int CServer::GetNumHumanPlayers(void) const int nHumans = 0; for (int i = 0; i < gpGlobals->maxClients; i++) { - CClient* pClient = g_pServer->GetClient(i); - if (!pClient) - continue; + const CClient* const pClient = g_pServer->GetClient(i); if (pClient->IsHumanPlayer()) nHumans++; @@ -67,9 +65,7 @@ int CServer::GetNumFakeClients(void) const int nBots = 0; for (int i = 0; i < gpGlobals->maxClients; i++) { - CClient* pClient = g_pServer->GetClient(i); - if (!pClient) - continue; + const CClient* const pClient = g_pServer->GetClient(i); if (pClient->IsConnected() && pClient->IsFakeClient()) nBots++; @@ -87,9 +83,7 @@ int CServer::GetNumClients(void) const int nClients = 0; for (int i = 0; i < gpGlobals->maxClients; i++) { - CClient* pClient = g_pServer->GetClient(i); - if (!pClient) - continue; + const CClient* const pClient = g_pServer->GetClient(i); if (pClient->IsConnected()) nClients++; diff --git a/src/engine/server/sv_main.cpp b/src/engine/server/sv_main.cpp index bbf223d1..a2ef8a60 100644 --- a/src/engine/server/sv_main.cpp +++ b/src/engine/server/sv_main.cpp @@ -79,10 +79,6 @@ void SV_CheckClientsForBan(const CBanSystem::BannedList_t* const pBannedVec /*= for (int c = 0; c < gpGlobals->maxClients; c++) // Loop through all possible client instances. { CClient* const pClient = g_pServer->GetClient(c); - - if (!pClient) - continue; - const CNetChan* const pNetChan = pClient->GetNetChan(); if (!pNetChan) @@ -199,9 +195,6 @@ void SV_BroadcastVoiceData(CClient* const cl, const int nBytes, char* const data { CClient* const pClient = g_pServer->GetClient(i); - if (!pClient) - continue; - // is this client fully connected if (pClient->GetSignonState() != SIGNONSTATE::SIGNONSTATE_FULL) continue; @@ -246,9 +239,6 @@ void SV_BroadcastDurangoVoiceData(CClient* const cl, const int nBytes, char* con { CClient* const pClient = g_pServer->GetClient(i); - if (!pClient) - continue; - // is this client fully connected if (pClient->GetSignonState() != SIGNONSTATE::SIGNONSTATE_FULL) continue; diff --git a/src/game/server/gameinterface.cpp b/src/game/server/gameinterface.cpp index 9a017b3e..a4044ce4 100644 --- a/src/game/server/gameinterface.cpp +++ b/src/game/server/gameinterface.cpp @@ -168,13 +168,13 @@ void CServerGameClients::_ProcessUserCmds(CServerGameClients* thisp, edict_t edi Assert(numCmds >= 0); Assert((totalCmds - numCmds) >= 0); - CPlayer* pPlayer = UTIL_PlayerByIndex(edict); + CPlayer* const pPlayer = UTIL_PlayerByIndex(edict); // Too many commands? if (totalCmds < 0 || totalCmds >= (MAX_BACKUP_COMMANDS_PROCESS - 1) || numCmds < 0 || numCmds > totalCmds) { - CClient* pClient = g_pServer->GetClient(edict-1); + const CClient* const pClient = g_pServer->GetClient(edict-1); Warning(eDLL_T::SERVER, "%s: Player '%s' sent too many cmds (%i)\n", __FUNCTION__, pClient->GetServerName(), totalCmds); buf->SetOverflowFlag(); diff --git a/src/game/server/physics_main.cpp b/src/game/server/physics_main.cpp index 2f95a31d..a3fa86e6 100644 --- a/src/game/server/physics_main.cpp +++ b/src/game/server/physics_main.cpp @@ -24,13 +24,11 @@ void Physics_RunBotSimulation(bool bSimulating) for (int i = 0; i < g_ServerGlobalVariables->maxClients; i++) { - CClient* pClient = g_pServer->GetClient(i); - if (!pClient) - continue; + const CClient* const pClient = g_pServer->GetClient(i); if (pClient->IsActive() && pClient->IsFakeClient()) { - CPlayer* pPlayer = UTIL_PlayerByIndex(pClient->GetHandle()); + CPlayer* const pPlayer = UTIL_PlayerByIndex(pClient->GetHandle()); if (pPlayer) pPlayer->RunNullCommand(); } diff --git a/src/networksystem/bansystem.cpp b/src/networksystem/bansystem.cpp index 4e01c0b6..a20822fd 100644 --- a/src/networksystem/bansystem.cpp +++ b/src/networksystem/bansystem.cpp @@ -314,11 +314,9 @@ void CBanSystem::AuthorPlayerByName(const char* playerName, const bool shouldBan for (int i = 0; i < gpGlobals->maxClients; i++) { - CClient* pClient = g_pServer->GetClient(i); - if (!pClient) - continue; + CClient* const pClient = g_pServer->GetClient(i); + const CNetChan* const pNetChan = pClient->GetNetChan(); - const CNetChan* pNetChan = pClient->GetNetChan(); if (!pNetChan) continue; @@ -365,11 +363,9 @@ void CBanSystem::AuthorPlayerById(const char* playerHandle, const bool shouldBan for (int i = 0; i < gpGlobals->maxClients; i++) { - CClient* pClient = g_pServer->GetClient(i); - if (!pClient) - continue; + CClient* const pClient = g_pServer->GetClient(i); + const CNetChan* const pNetChan = pClient->GetNetChan(); - const CNetChan* pNetChan = pClient->GetNetChan(); if (!pNetChan) continue;