From 47b675e47c6767c03de30854e7bc7071c8a078ea Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 9 Jun 2012 15:37:34 +0000 Subject: More ini settings save their defaults git-svn-id: http://mc-server.googlecode.com/svn/trunk@588 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cRoot.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source/cRoot.cpp') diff --git a/source/cRoot.cpp b/source/cRoot.cpp index 69d854ee1..41a1a2432 100644 --- a/source/cRoot.cpp +++ b/source/cRoot.cpp @@ -103,13 +103,15 @@ void cRoot::Start() m_Server = new cServer(); LOG("Starting server..."); - cIniFile IniFile("settings.ini"); IniFile.ReadFile(); - int Port = IniFile.GetValueI("Server", "Port", 25565 ); + cIniFile IniFile("settings.ini"); + IniFile.ReadFile(); + int Port = IniFile.GetValueSetI("Server", "Port", 25565 ); if(!m_Server->InitServer( Port )) { LOG("Failed to start server, shutting down."); return; } + IniFile.WriteFile(); cIniFile WebIniFile("webadmin.ini"); if( WebIniFile.ReadFile() ) @@ -210,7 +212,7 @@ void cRoot::LoadWorlds(void) cIniFile IniFile("settings.ini"); IniFile.ReadFile(); // First get the default world - AString DefaultWorldName = IniFile.GetValue("Worlds", "DefaultWorld", "world"); + AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world"); m_pState->pDefaultWorld = new cWorld( DefaultWorldName.c_str() ); m_pState->WorldsByName[ DefaultWorldName ] = m_pState->pDefaultWorld; @@ -224,12 +226,12 @@ void cRoot::LoadWorlds(void) for (unsigned int i = 0; i < NumWorlds; i++) { - std::string ValueName = IniFile.GetValueName(KeyNum, i ); + AString ValueName = IniFile.GetValueName(KeyNum, i ); if (ValueName.compare("World") != 0) { continue; } - std::string WorldName = IniFile.GetValue(KeyNum, i ); + AString WorldName = IniFile.GetValue(KeyNum, i ); if (WorldName.empty()) { continue; -- cgit v1.2.3