diff options
Diffstat (limited to 'source/Root.cpp')
-rw-r--r-- | source/Root.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/source/Root.cpp b/source/Root.cpp index 290a5269a..e992ff614 100644 --- a/source/Root.cpp +++ b/source/Root.cpp @@ -116,8 +116,8 @@ void cRoot::Start(void) m_Server = new cServer(); LOG("Reading server config..."); - cIniFile IniFile("settings.ini"); - if (!IniFile.ReadFile()) + cIniFile IniFile; + if (!IniFile.ReadFile("settings.ini")) { LOGWARNING("settings.ini inaccessible, all settings are reset to default values"); } @@ -138,9 +138,7 @@ void cRoot::Start(void) LOGERROR("Failure starting server, aborting..."); return; } - IniFile.WriteFile(); - LOG("Initialising WebAdmin..."); m_WebAdmin = new cWebAdmin(); m_WebAdmin->Init(); @@ -150,7 +148,7 @@ void cRoot::Start(void) m_FurnaceRecipe = new cFurnaceRecipe(); LOGD("Loading worlds..."); - LoadWorlds(); + LoadWorlds(IniFile); LOGD("Loading plugin manager..."); m_PluginManager = new cPluginManager(); @@ -161,8 +159,10 @@ void cRoot::Start(void) // This sets stuff in motion LOGD("Starting Authenticator..."); - m_Authenticator.Start(); + m_Authenticator.Start(IniFile); + IniFile.WriteFile("settings.ini"); + LOGD("Starting worlds..."); StartWorlds(); @@ -172,7 +172,6 @@ void cRoot::Start(void) LOGD("Finalising startup..."); m_Server->Start(); - LOG("Starting WebAdmin..."); m_WebAdmin->Start(); #if !defined(ANDROID_NDK) @@ -210,7 +209,6 @@ void cRoot::Start(void) LOGD("Freeing MonsterConfig..."); delete m_MonsterConfig; m_MonsterConfig = NULL; - LOGD("Stopping WebAdmin..."); delete m_WebAdmin; m_WebAdmin = NULL; LOGD("Unloading recipes..."); delete m_FurnaceRecipe; m_FurnaceRecipe = NULL; @@ -248,10 +246,8 @@ void cRoot::LoadGlobalSettings() -void cRoot::LoadWorlds(void) +void cRoot::LoadWorlds(cIniFile & IniFile) { - cIniFile IniFile("settings.ini"); IniFile.ReadFile(); - // First get the default world AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world"); m_pDefaultWorld = new cWorld( DefaultWorldName.c_str() ); |