summaryrefslogtreecommitdiffstats
path: root/source/Server.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-14 10:24:34 +0200
committermadmaxoft <github@xoft.cz>2013-08-14 10:24:34 +0200
commit8c3837987bd5f74563790c15a1d52755383135ae (patch)
treeb91188a05d3a3053d5ad08cd7bb550c9d4b5518b /source/Server.h
parentExported cWorld:BroadcastChat() to the Lua API; used in the Core. (diff)
downloadcuberite-8c3837987bd5f74563790c15a1d52755383135ae.tar
cuberite-8c3837987bd5f74563790c15a1d52755383135ae.tar.gz
cuberite-8c3837987bd5f74563790c15a1d52755383135ae.tar.bz2
cuberite-8c3837987bd5f74563790c15a1d52755383135ae.tar.lz
cuberite-8c3837987bd5f74563790c15a1d52755383135ae.tar.xz
cuberite-8c3837987bd5f74563790c15a1d52755383135ae.tar.zst
cuberite-8c3837987bd5f74563790c15a1d52755383135ae.zip
Diffstat (limited to 'source/Server.h')
-rw-r--r--source/Server.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/Server.h b/source/Server.h
index 6f8576ece..87e472465 100644
--- a/source/Server.h
+++ b/source/Server.h
@@ -43,7 +43,7 @@ public: // tolua_export
// Player counts:
int GetMaxPlayers(void) const {return m_MaxPlayers; }
- int GetNumPlayers(void) const { return m_NumPlayers; }
+ int GetNumPlayers(void);
void SetMaxPlayers(int a_MaxPlayers) { m_MaxPlayers = a_MaxPlayers; }
// tolua_end
@@ -78,6 +78,12 @@ public: // tolua_export
/// Don't tick a_Client anymore, it will be ticked from its cPlayer instead
void ClientMovedToWorld(const cClientHandle * a_Client);
+ /// Notifies the server that a player was created; the server uses this to adjust the number of players
+ void PlayerCreated(const cPlayer * a_Player);
+
+ /// Notifies the server that a player was destroyed; the server uses this to adjust the number of players
+ void PlayerDestroyed(const cPlayer * a_Player);
+
CryptoPP::RSA::PrivateKey & GetPrivateKey(void) { return m_PrivateKey; }
CryptoPP::RSA::PublicKey & GetPublicKey (void) { return m_PublicKey; }
@@ -135,6 +141,11 @@ 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
+ 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
+
cSocketThreads m_SocketThreads;
int m_ClientViewDistance; // The default view distance for clients; settable in Settings.ini
@@ -150,7 +161,6 @@ private:
AString m_Description;
int m_MaxPlayers;
- int m_NumPlayers;
cTickThread m_TickThread;
cEvent m_RestartEvent;