diff options
author | madmaxoft <github@xoft.cz> | 2013-08-11 19:18:06 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-11 19:18:06 +0200 |
commit | eb9d45e9065a94c93dc2f1624c22f026b9be3d5f (patch) | |
tree | e88be00ec679f95f23199a7056166ef792d74cf7 /source/Server.cpp | |
parent | Added doxyComments for cIsThread. (diff) | |
download | cuberite-eb9d45e9065a94c93dc2f1624c22f026b9be3d5f.tar cuberite-eb9d45e9065a94c93dc2f1624c22f026b9be3d5f.tar.gz cuberite-eb9d45e9065a94c93dc2f1624c22f026b9be3d5f.tar.bz2 cuberite-eb9d45e9065a94c93dc2f1624c22f026b9be3d5f.tar.lz cuberite-eb9d45e9065a94c93dc2f1624c22f026b9be3d5f.tar.xz cuberite-eb9d45e9065a94c93dc2f1624c22f026b9be3d5f.tar.zst cuberite-eb9d45e9065a94c93dc2f1624c22f026b9be3d5f.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Server.cpp | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/source/Server.cpp b/source/Server.cpp index b07c65f04..509c84af3 100644 --- a/source/Server.cpp +++ b/source/Server.cpp @@ -76,6 +76,38 @@ struct cServer::sServerState +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cServer: + +cServer::cServer(void) : + m_pState(new sServerState), + m_ListenThreadIPv4(*this, cSocket::IPv4, "Client"), + m_ListenThreadIPv6(*this, cSocket::IPv6, "Client"), + m_Millisecondsf(0), + m_Milliseconds(0), + m_bIsConnected(false), + m_bRestarting(false), + m_RCONServer(*this) +{ +} + + + + + +cServer::~cServer() +{ + // TODO: Shut down the server gracefully + m_pState->bStopTickThread = true; + delete m_pState->pTickThread; m_pState->pTickThread = NULL; + + delete m_pState; +} + + + + + void cServer::ClientDestroying(const cClientHandle * a_Client) { m_SocketThreads.StopReading(a_Client); @@ -123,6 +155,9 @@ void cServer::RemoveClient(const cClientHandle * a_Client) bool cServer::InitServer(cIniFile & a_SettingsIni) { + m_Description = a_SettingsIni.GetValue ("Server", "Description", "MCServer! - In C++!").c_str(); + m_MaxPlayers = a_SettingsIni.GetValueI("Server", "MaxPlayers", 100); + if (m_bIsConnected) { LOGERROR("ERROR: Trying to initialize server while server is already running!"); @@ -201,35 +236,6 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) -cServer::cServer(void) - : m_pState(new sServerState) - , m_ListenThreadIPv4(*this, cSocket::IPv4, "Client") - , m_ListenThreadIPv6(*this, cSocket::IPv6, "Client") - , m_Millisecondsf(0) - , m_Milliseconds(0) - , m_bIsConnected(false) - , m_bRestarting(false) - , m_RCONServer(*this) -{ -} - - - - - -cServer::~cServer() -{ - // TODO: Shut down the server gracefully - m_pState->bStopTickThread = true; - delete m_pState->pTickThread; m_pState->pTickThread = NULL; - - delete m_pState; -} - - - - - void cServer::PrepareKeys(void) { // TODO: Save and load key for persistence across sessions |