From ebea2b7efc1775de66e0c6b6ee66da6f9ad04422 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 11 Jul 2014 13:13:10 +0200 Subject: Player data filenames are based on UUID. --- src/Server.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 2c695cc70..5d1e51036 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -258,6 +258,9 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) m_ServerID.resize(16, '0'); } + m_ShouldLoadOfflinePlayerData = a_SettingsIni.GetValueSetB("PlayerData", "LoadOfflinePlayerData", false); + m_ShouldLoadNamedPlayerData = a_SettingsIni.GetValueSetB("PlayerData", "LoadNamedPlayerData", true); + m_ClientViewDistance = a_SettingsIni.GetValueSetI("Server", "DefaultViewDistance", cClientHandle::DEFAULT_VIEW_DISTANCE); if (m_ClientViewDistance < cClientHandle::MIN_VIEW_DISTANCE) { -- cgit v1.2.3 From 6484e9814a3a540518606f552398e0b82f91ab4d Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 13 Jul 2014 00:16:49 +0100 Subject: Only one instance of server can be started This disallows the UDP multicasting that the original code enabled. xoft deterrent, in PR #1151 you implied that this was unwanted behaviour (but comments gone now as I force pushed - check emails?). Revert at will if unsatisfactory :P --- src/Server.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 5d1e51036..9220731eb 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -221,14 +221,12 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) bool HasAnyPorts = false; AString Ports = a_SettingsIni.GetValueSet("Server", "Port", "25565"); - m_ListenThreadIPv4.SetReuseAddr(true); if (m_ListenThreadIPv4.Initialize(Ports)) { HasAnyPorts = true; } Ports = a_SettingsIni.GetValueSet("Server", "PortsIPv6", "25565"); - m_ListenThreadIPv6.SetReuseAddr(true); if (m_ListenThreadIPv6.Initialize(Ports)) { HasAnyPorts = true; -- cgit v1.2.3 From 4e24f711abd3d6a93f01ee7c297eb67c8aedbd37 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 14 Jul 2014 19:49:31 +0100 Subject: Player properties are now retrieved --- src/Server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 9220731eb..8b479292e 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -656,14 +656,14 @@ void cServer::KickUser(int a_ClientID, const AString & a_Reason) -void cServer::AuthenticateUser(int a_ClientID, const AString & a_Name, const AString & a_UUID) +void cServer::AuthenticateUser(int a_ClientID, const AString & a_Name, const AString & a_UUID, const AString & a_Properties) { cCSLock Lock(m_CSClients); for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr) { if ((*itr)->GetUniqueID() == a_ClientID) { - (*itr)->Authenticate(a_Name, a_UUID); + (*itr)->Authenticate(a_Name, a_UUID, a_Properties); return; } } // for itr - m_Clients[] -- cgit v1.2.3 From 1f6854792cdd6792b27c4f9f3d7d857df9dd64bf Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 16 Jul 2014 00:03:47 +0100 Subject: Store properties as Json::Value --- src/Server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 8b479292e..17551eeb1 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -656,7 +656,7 @@ void cServer::KickUser(int a_ClientID, const AString & a_Reason) -void cServer::AuthenticateUser(int a_ClientID, const AString & a_Name, const AString & a_UUID, const AString & a_Properties) +void cServer::AuthenticateUser(int a_ClientID, const AString & a_Name, const AString & a_UUID, const Json::Value & a_Properties) { cCSLock Lock(m_CSClients); for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr) -- cgit v1.2.3 From 7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 19:13:23 +0200 Subject: Fixed spaces around single-line comments. There should be at least two spaces in front and one space after //-style comments. --- src/Server.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 17551eeb1..81ecd38b2 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -202,7 +202,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) m_PlayerCount = 0; m_PlayerCountDiff = 0; - m_FaviconData = Base64Encode(cFile::ReadWholeFile(FILE_IO_PREFIX + AString("favicon.png"))); // Will return empty string if file nonexistant; client doesn't mind + m_FaviconData = Base64Encode(cFile::ReadWholeFile(FILE_IO_PREFIX + AString("favicon.png"))); // Will return empty string if file nonexistant; client doesn't mind if (m_bIsConnected) { @@ -213,7 +213,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS); LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); - if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever + if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever { LOGERROR("WSAStartup() != 0"); return false; @@ -409,7 +409,7 @@ void cServer::TickClients(float a_Dt) for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr) { delete *itr; - } // for itr - RemoveClients[] + } // for itr - RemoveClients[] } -- cgit v1.2.3 From 2423fbf2efa39e28cc348acc11b9269e573dcdef Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 22:15:34 +0200 Subject: Normalized comments. This was mostly done automatically and then visually inspected for obvious errors. All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign. --- src/Server.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 81ecd38b2..bc9644804 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -60,7 +60,7 @@ typedef std::list< cClientHandle* > ClientList; -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // cServer::cTickThread: cServer::cTickThread::cTickThread(cServer & a_Server) : @@ -101,7 +101,7 @@ void cServer::cTickThread::Execute(void) -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // cServer: cServer::cServer(void) : @@ -673,7 +673,7 @@ void cServer::AuthenticateUser(int a_ClientID, const AString & a_Name, const ASt -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// // cServer::cNotifyWriteThread: cServer::cNotifyWriteThread::cNotifyWriteThread(void) : -- cgit v1.2.3 From d52a51f7b6530d2a63682798472840d7261ebad4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 18 Jul 2014 09:18:00 +0200 Subject: Removed duplicate IPvX labels. --- src/Server.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index bc9644804..10a354a36 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -105,8 +105,8 @@ void cServer::cTickThread::Execute(void) // cServer: cServer::cServer(void) : - m_ListenThreadIPv4(*this, cSocket::IPv4, "Client IPv4"), - m_ListenThreadIPv6(*this, cSocket::IPv6, "Client IPv6"), + m_ListenThreadIPv4(*this, cSocket::IPv4, "Client"), + m_ListenThreadIPv6(*this, cSocket::IPv6, "Client"), m_PlayerCount(0), m_PlayerCountDiff(0), m_ClientViewDistance(0), -- cgit v1.2.3