diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-05 17:20:48 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-05 17:20:48 +0200 |
commit | d832996e198605c20760c72433e35beca3192a5a (patch) | |
tree | aedaefb6b7753a14eb27c7c6fd3e8e3a3b7c3df3 /source/cRoot.cpp | |
parent | Fixed previous commit's recipes and items. (diff) | |
download | cuberite-d832996e198605c20760c72433e35beca3192a5a.tar cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.gz cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.bz2 cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.lz cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.xz cuberite-d832996e198605c20760c72433e35beca3192a5a.tar.zst cuberite-d832996e198605c20760c72433e35beca3192a5a.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cRoot.cpp | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/source/cRoot.cpp b/source/cRoot.cpp index 4220c0f41..69d854ee1 100644 --- a/source/cRoot.cpp +++ b/source/cRoot.cpp @@ -141,6 +141,9 @@ void cRoot::Start() LOG("Starting Authenticator...");
m_Authenticator.Start();
+ LOG("Starting worlds...");
+ StartWorlds();
+
LOG("Starting server...");
m_Server->StartListenThread();
//cHeartBeat* HeartBeat = new cHeartBeat();
@@ -202,35 +205,49 @@ void cRoot::LoadGlobalSettings() -void cRoot::LoadWorlds()
+void cRoot::LoadWorlds(void)
{
cIniFile IniFile("settings.ini"); IniFile.ReadFile();
// First get the default world
AString DefaultWorldName = IniFile.GetValue("Worlds", "DefaultWorld", "world");
m_pState->pDefaultWorld = new cWorld( DefaultWorldName.c_str() );
- m_pState->pDefaultWorld->InitializeSpawn();
m_pState->WorldsByName[ DefaultWorldName ] = m_pState->pDefaultWorld;
// Then load the other worlds
unsigned int KeyNum = IniFile.FindKey("Worlds");
unsigned int NumWorlds = IniFile.GetNumValues( KeyNum );
- if ( NumWorlds > 0 )
+ if (NumWorlds <= 0)
+ {
+ return;
+ }
+
+ for (unsigned int i = 0; i < NumWorlds; i++)
{
- for (unsigned int i = 0; i < NumWorlds; i++)
+ std::string ValueName = IniFile.GetValueName(KeyNum, i );
+ if (ValueName.compare("World") != 0)
{
- std::string ValueName = IniFile.GetValueName(KeyNum, i );
- if( ValueName.compare("World") == 0 )
- {
- std::string WorldName = IniFile.GetValue(KeyNum, i );
- if (!WorldName.empty())
- {
- cWorld* NewWorld = new cWorld( WorldName.c_str() );
- NewWorld->InitializeSpawn();
- m_pState->WorldsByName[ WorldName ] = NewWorld;
- }
- }
+ continue;
+ }
+ std::string WorldName = IniFile.GetValue(KeyNum, i );
+ if (WorldName.empty())
+ {
+ continue;
}
+ cWorld* NewWorld = new cWorld( WorldName.c_str() );
+ m_pState->WorldsByName[ WorldName ] = NewWorld;
+ } // for i - Worlds
+}
+
+
+
+
+
+void cRoot::StartWorlds(void)
+{
+ for( WorldMap::iterator itr = m_pState->WorldsByName.begin(); itr != m_pState->WorldsByName.end(); ++itr )
+ {
+ itr->second->InitializeSpawn();
}
}
@@ -238,7 +255,7 @@ void cRoot::LoadWorlds() -void cRoot::UnloadWorlds()
+void cRoot::UnloadWorlds(void)
{
for( WorldMap::iterator itr = m_pState->WorldsByName.begin(); itr != m_pState->WorldsByName.end(); ++itr )
{
|