summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ClientHandle.cpp8
-rw-r--r--src/Server.cpp2
-rw-r--r--src/Server.h4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 580e786c9..7f80299f6 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -453,14 +453,14 @@ void cClientHandle::HandlePing(void)
{
// Somebody tries to retrieve information about the server
AString Reply;
- cServer * Server = cRoot::Get()->GetServer();
+ const cServer & Server = *cRoot::Get()->GetServer();
Printf(Reply, "%s%s%i%s%i",
- Server->GetDescription().c_str(),
+ Server.GetDescription().c_str(),
cChatColor::Delimiter.c_str(),
- Server->GetNumPlayers(),
+ Server.GetNumPlayers(),
cChatColor::Delimiter.c_str(),
- Server->GetMaxPlayers()
+ Server.GetMaxPlayers()
);
Kick(Reply);
}
diff --git a/src/Server.cpp b/src/Server.cpp
index fa4a1a133..bfb1b1cbb 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -275,7 +275,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
-int cServer::GetNumPlayers(void)
+int cServer::GetNumPlayers(void) const
{
cCSLock Lock(m_CSPlayerCount);
return m_PlayerCount;
diff --git a/src/Server.h b/src/Server.h
index b5c384a44..51c450ebd 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -59,7 +59,7 @@ public: // tolua_export
// Player counts:
int GetMaxPlayers(void) const {return m_MaxPlayers; }
- int GetNumPlayers(void);
+ int GetNumPlayers(void) const;
void SetMaxPlayers(int a_MaxPlayers) { m_MaxPlayers = a_MaxPlayers; }
// Hardcore mode or not:
@@ -168,7 +168,7 @@ private:
cClientHandleList m_Clients; ///< Clients that are connected to the server and not yet assigned to a cWorld
cClientHandleList m_ClientsToRemove; ///< Clients that have just been moved into a world and are to be removed from m_Clients in the next Tick()
- cCriticalSection m_CSPlayerCount; ///< Locks the m_PlayerCount
+ mutable cCriticalSection m_CSPlayerCount; ///< Locks the m_PlayerCount
int m_PlayerCount; ///< Number of players currently playing in the server
cCriticalSection m_CSPlayerCountDiff; ///< Locks the m_PlayerCountDiff
int m_PlayerCountDiff; ///< Adjustment to m_PlayerCount to be applied in the Tick thread