summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-27 09:04:39 +0100
committermadmaxoft <github@xoft.cz>2013-10-27 09:04:39 +0100
commitf032a2ff742f408a0400b4267ab67d6dae86ead2 (patch)
treee1e6d9233fa8354d4ef0dc4666f4e4ddc90d3880 /source
parentAPIDump: Documented cPickup. (diff)
parentChanged "cIniFile IniFile" to cIniFile & IniFile" (diff)
downloadcuberite-f032a2ff742f408a0400b4267ab67d6dae86ead2.tar
cuberite-f032a2ff742f408a0400b4267ab67d6dae86ead2.tar.gz
cuberite-f032a2ff742f408a0400b4267ab67d6dae86ead2.tar.bz2
cuberite-f032a2ff742f408a0400b4267ab67d6dae86ead2.tar.lz
cuberite-f032a2ff742f408a0400b4267ab67d6dae86ead2.tar.xz
cuberite-f032a2ff742f408a0400b4267ab67d6dae86ead2.tar.zst
cuberite-f032a2ff742f408a0400b4267ab67d6dae86ead2.zip
Diffstat (limited to '')
-rw-r--r--source/Authenticator.cpp12
-rw-r--r--source/Authenticator.h4
-rw-r--r--source/Root.cpp9
-rw-r--r--source/Root.h2
4 files changed, 9 insertions, 18 deletions
diff --git a/source/Authenticator.cpp b/source/Authenticator.cpp
index d7e05b4c2..a32e9ce8f 100644
--- a/source/Authenticator.cpp
+++ b/source/Authenticator.cpp
@@ -28,7 +28,6 @@ cAuthenticator::cAuthenticator(void) :
m_Address(DEFAULT_AUTH_ADDRESS),
m_ShouldAuthenticate(true)
{
- ReadINI();
}
@@ -45,14 +44,8 @@ cAuthenticator::~cAuthenticator()
/// Read custom values from INI
-void cAuthenticator::ReadINI(void)
+void cAuthenticator::ReadINI(cIniFile & IniFile)
{
- cIniFile IniFile;
- if (!IniFile.ReadFile("settings.ini"))
- {
- return;
- }
-
m_Server = IniFile.GetValue("Authentication", "Server");
m_Address = IniFile.GetValue("Authentication", "Address");
m_ShouldAuthenticate = IniFile.GetValueB("Authentication", "Authenticate", true);
@@ -100,8 +93,9 @@ void cAuthenticator::Authenticate(int a_ClientID, const AString & a_UserName, co
-void cAuthenticator::Start(void)
+void cAuthenticator::Start(cIniFile & IniFile)
{
+ ReadINI(IniFile);
m_ShouldTerminate = false;
super::Start();
}
diff --git a/source/Authenticator.h b/source/Authenticator.h
index 868476d80..02cd6f4c5 100644
--- a/source/Authenticator.h
+++ b/source/Authenticator.h
@@ -37,13 +37,13 @@ public:
~cAuthenticator();
/// (Re-)read server and address from INI:
- void ReadINI(void);
+ void ReadINI(cIniFile & IniFile);
/// Queues a request for authenticating a user. If the auth fails, the user is kicked
void Authenticate(int a_ClientID, const AString & a_UserName, const AString & a_ServerHash);
/// Starts the authenticator thread. The thread may be started and stopped repeatedly
- void Start(void);
+ void Start(cIniFile & IniFile);
/// Stops the authenticator thread. The thread may be started and stopped repeatedly
void Stop(void);
diff --git a/source/Root.cpp b/source/Root.cpp
index f47de972c..2397fc875 100644
--- a/source/Root.cpp
+++ b/source/Root.cpp
@@ -149,7 +149,7 @@ void cRoot::Start(void)
m_FurnaceRecipe = new cFurnaceRecipe();
LOGD("Loading worlds...");
- LoadWorlds();
+ LoadWorlds(IniFile);
LOGD("Loading plugin manager...");
m_PluginManager = new cPluginManager();
@@ -160,7 +160,7 @@ void cRoot::Start(void)
// This sets stuff in motion
LOGD("Starting Authenticator...");
- m_Authenticator.Start();
+ m_Authenticator.Start(IniFile);
LOGD("Starting worlds...");
StartWorlds();
@@ -245,11 +245,8 @@ void cRoot::LoadGlobalSettings()
-void cRoot::LoadWorlds(void)
+void cRoot::LoadWorlds(cIniFile & IniFile)
{
- cIniFile IniFile;
- IniFile.ReadFile("settings.ini"); // Doesn't matter if success or not
-
// First get the default world
AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world");
m_pDefaultWorld = new cWorld( DefaultWorldName.c_str() );
diff --git a/source/Root.h b/source/Root.h
index c05b29d14..175084c53 100644
--- a/source/Root.h
+++ b/source/Root.h
@@ -162,7 +162,7 @@ private:
void LoadGlobalSettings();
/// Loads the worlds from settings.ini, creates the worldmap
- void LoadWorlds(void);
+ void LoadWorlds(cIniFile & IniFile);
/// Starts each world's life
void StartWorlds(void);