summaryrefslogtreecommitdiffstats
path: root/source/cServer.cpp
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-25 14:44:22 +0100
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-25 14:44:22 +0100
commitd0a7f9a57d734ce99da262fdf7dd206351fa8ac3 (patch)
tree0a1314457d6fb3d097b6bd08ce2135c86b0f94df /source/cServer.cpp
parentThe missing file! cChunkGenerator.h/cpp (diff)
downloadcuberite-d0a7f9a57d734ce99da262fdf7dd206351fa8ac3.tar
cuberite-d0a7f9a57d734ce99da262fdf7dd206351fa8ac3.tar.gz
cuberite-d0a7f9a57d734ce99da262fdf7dd206351fa8ac3.tar.bz2
cuberite-d0a7f9a57d734ce99da262fdf7dd206351fa8ac3.tar.lz
cuberite-d0a7f9a57d734ce99da262fdf7dd206351fa8ac3.tar.xz
cuberite-d0a7f9a57d734ce99da262fdf7dd206351fa8ac3.tar.zst
cuberite-d0a7f9a57d734ce99da262fdf7dd206351fa8ac3.zip
Diffstat (limited to 'source/cServer.cpp')
-rw-r--r--source/cServer.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/cServer.cpp b/source/cServer.cpp
index 5fbd6d8c7..ebd91db94 100644
--- a/source/cServer.cpp
+++ b/source/cServer.cpp
@@ -23,6 +23,8 @@
#include "cTracer.h"
#include "cWebAdmin.h"
+#include "MersenneTwister.h"
+
#include "../iniFile/iniFile.h"
#include "Vector3f.h"
@@ -196,6 +198,9 @@ bool cServer::InitServer( int a_Port )
if( IniFile.ReadFile() )
{
g_bWaterPhysics = IniFile.GetValueB("Physics", "Water", false );
+
+ /* Replaced below with 1.0.0 compatible ServerID generation
+
std::string ServerID = IniFile.GetValue("Server", "ServerID");
if( ServerID.empty() )
{
@@ -203,7 +208,19 @@ bool cServer::InitServer( int a_Port )
IniFile.SetValue("Server", "ServerID", ServerID, true );
IniFile.WriteFile();
}
- m_pState->ServerID = ServerID;
+ */
+ m_pState->ServerID = "-";
+ if (IniFile.GetValueB("Authentication", "Authenticate"))
+ {
+ MTRand mtrand1;
+ unsigned int r1 = (mtrand1.randInt()%1147483647) + 1000000000;
+ unsigned int r2 = (mtrand1.randInt()%1147483647) + 1000000000;
+ std::ostringstream sid;
+ sid << std::hex << r1;
+ sid << std::hex << r2;
+ std::string ServerID = sid.str();
+ m_pState->ServerID = ServerID;
+ }
}
return true;
}