summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-01-12 14:25:40 +0100
committerMattes D <github@xoft.cz>2016-01-12 14:25:40 +0100
commit0b20d7ab96426c5a206702ab8dcef36ec8864a59 (patch)
treeb1d5c989c0b8992cba91e0f53674d1e5a2a11ce6 /src
parentMerge pull request #2859 from LogicParrot/attack2 (diff)
parentFixed crash introduced by #2821 (diff)
downloadcuberite-0b20d7ab96426c5a206702ab8dcef36ec8864a59.tar
cuberite-0b20d7ab96426c5a206702ab8dcef36ec8864a59.tar.gz
cuberite-0b20d7ab96426c5a206702ab8dcef36ec8864a59.tar.bz2
cuberite-0b20d7ab96426c5a206702ab8dcef36ec8864a59.tar.lz
cuberite-0b20d7ab96426c5a206702ab8dcef36ec8864a59.tar.xz
cuberite-0b20d7ab96426c5a206702ab8dcef36ec8864a59.tar.zst
cuberite-0b20d7ab96426c5a206702ab8dcef36ec8864a59.zip
Diffstat (limited to '')
-rw-r--r--src/Root.cpp60
1 files changed, 31 insertions, 29 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index dc00b5c82..71d5875a6 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -369,43 +369,45 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn
if (DefaultWorldName == "world")
{
auto DefaultWorldIniFile= cpp14::make_unique<cIniFile>();
- assert(DefaultWorldIniFile->ReadFile("world/world.ini"));
- AString NetherName = DefaultWorldIniFile->GetValue("LinkedWorlds", "NetherWorldName", "");
- AString EndName = DefaultWorldIniFile->GetValue("LinkedWorlds", "EndWorldName", "");
- if ((NetherName.compare("world_nether") == 0) && (EndName.compare("world_end") == 0))
+ if (DefaultWorldIniFile->ReadFile("world/world.ini"))
{
- // This is a default world linkage config, see if the nether and end are in settings.ini
- // If both of them are not in settings.ini, then this is a pre-#2815 default config
- // so we add them to settings.ini
- // Note that if only one of them is not in settings.ini, it's nondefault and we don't touch it
+ AString NetherName = DefaultWorldIniFile->GetValue("LinkedWorlds", "NetherWorldName", "");
+ AString EndName = DefaultWorldIniFile->GetValue("LinkedWorlds", "EndWorldName", "");
+ if ((NetherName.compare("world_nether") == 0) && (EndName.compare("world_end") == 0))
+ {
+ // This is a default world linkage config, see if the nether and end are in settings.ini
+ // If both of them are not in settings.ini, then this is a pre-#2815 default config
+ // so we add them to settings.ini
+ // Note that if only one of them is not in settings.ini, it's nondefault and we don't touch it
- bool NetherInSettings = false;
- bool EndInSettings = false;
+ bool NetherInSettings = false;
+ bool EndInSettings = false;
- for (auto WorldNameValue : Worlds)
- {
- AString ValueName = WorldNameValue.first;
- if (ValueName.compare("World") != 0)
- {
- continue;
- }
- AString WorldName = WorldNameValue.second;
- if (WorldName.compare("world_nether") == 0)
+ for (auto WorldNameValue : Worlds)
{
- NetherInSettings = true;
+ AString ValueName = WorldNameValue.first;
+ if (ValueName.compare("World") != 0)
+ {
+ continue;
+ }
+ AString WorldName = WorldNameValue.second;
+ if (WorldName.compare("world_nether") == 0)
+ {
+ NetherInSettings = true;
+ }
+ else if (WorldName.compare("world_end") == 0)
+ {
+ EndInSettings = true;
+ }
}
- else if (WorldName.compare("world_end") == 0)
+
+ if ((!NetherInSettings) && (!EndInSettings))
{
- EndInSettings = true;
+ a_Settings.AddValue("Worlds", "World", "world_nether");
+ a_Settings.AddValue("Worlds", "World", "world_end");
+ Worlds = a_Settings.GetValues("Worlds"); // Refresh the Worlds list so that the rest of the function works as usual
}
}
-
- if ((!NetherInSettings) && (!EndInSettings))
- {
- a_Settings.AddValue("Worlds", "World", "world_nether");
- a_Settings.AddValue("Worlds", "World", "world_end");
- Worlds = a_Settings.GetValues("Worlds"); // Refresh the Worlds list so that the rest of the function works as usual
- }
}
}