From f6c7196408667cb1055d7ce25549cf05239271d3 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 19 Aug 2007 15:47:53 +0000 Subject: [PATCH] fixed a bug where the player count could be trashed across bad mapchanges. additionally, it gets hard reset on mapchange as a safety precaution. --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401364 --- core/PlayerManager.cpp | 8 +++++++- core/PlayerManager.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 1532f73f..a02ac65f 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -475,6 +475,7 @@ void PlayerManager::OnSourceModLevelEnd() OnClientDisconnect(m_Players[i].GetEdict()); } } + m_PlayerCount = 0; } void PlayerManager::OnClientDisconnect(edict_t *pEntity) @@ -491,7 +492,7 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity) return; } - if (m_Players[client].IsInGame()) + if (m_Players[client].WasCountedAsInGame()) { m_PlayerCount--; } @@ -884,6 +885,11 @@ bool CPlayer::IsInGame() return m_IsInGame && (m_pEdict->GetUnknown() != NULL); } +bool CPlayer::WasCountedAsInGame() +{ + return m_IsInGame; +} + bool CPlayer::IsConnected() { return m_IsConnected; diff --git a/core/PlayerManager.h b/core/PlayerManager.h index 670dc491..6a69ee07 100644 --- a/core/PlayerManager.h +++ b/core/PlayerManager.h @@ -55,6 +55,7 @@ public: const char *GetAuthString(); edict_t *GetEdict(); bool IsInGame(); + bool WasCountedAsInGame(); bool IsConnected(); bool IsAuthorized(); bool IsFakeClient();