diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-04 15:06:37 +0100 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-05 14:34:16 +0100 |
commit | d8861da5990315c415cd250c9d2a8a4f2b9d122b (patch) | |
tree | ffc94dd94cbb5029b66bf6cf2555bb825392d77f /src/World.cpp | |
parent | Merge pull request #2960 from LogicParrot/interspecies (diff) | |
download | cuberite-d8861da5990315c415cd250c9d2a8a4f2b9d122b.tar cuberite-d8861da5990315c415cd250c9d2a8a4f2b9d122b.tar.gz cuberite-d8861da5990315c415cd250c9d2a8a4f2b9d122b.tar.bz2 cuberite-d8861da5990315c415cd250c9d2a8a4f2b9d122b.tar.lz cuberite-d8861da5990315c415cd250c9d2a8a4f2b9d122b.tar.xz cuberite-d8861da5990315c415cd250c9d2a8a4f2b9d122b.tar.zst cuberite-d8861da5990315c415cd250c9d2a8a4f2b9d122b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/World.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/World.cpp b/src/World.cpp index 5b6a215d8..3d56cbe2e 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -520,6 +520,40 @@ void cWorld::Start(void) m_LinkedOverworldName = IniFile.GetValueSet("LinkedWorlds", "OverworldName", GetLinkedOverworldName()); } + // If we are linked to one or more worlds that do not exist, ask the server to stop. + AString BadWorlds = ""; + cRoot * Root = cRoot::Get(); + if (GetDimension() == dimOverworld) + { + if ((!m_LinkedNetherWorldName.empty()) && (Root->GetWorld(m_LinkedNetherWorldName) == nullptr)) + { + BadWorlds = m_LinkedNetherWorldName; + } + if ((!m_LinkedEndWorldName.empty()) && (Root->GetWorld(m_LinkedEndWorldName) == nullptr)) + { + if (!(BadWorlds.empty())) + { + BadWorlds += ", "; + } + BadWorlds += m_LinkedEndWorldName; + } + } + else + { + if ((!m_LinkedOverworldName.empty()) && (Root->GetWorld(m_LinkedOverworldName) == nullptr)) + { + BadWorlds = m_LinkedOverworldName; + } + } + if (!BadWorlds.empty()) + { + const char * WorldName = m_WorldName.c_str(); + LOGERROR("\n######\nERROR: %s is linked to one or more invalid worlds: %s\nPlease edit %s/world.ini and fix this.\n######\n", + WorldName, BadWorlds.c_str(), WorldName); + cRoot::Get()->StopServer(); + } + + // Adjust the enum-backed variables into their respective bounds: m_GameMode = static_cast<eGameMode> (Clamp<int>(GameMode, gmSurvival, gmSpectator)); m_TNTShrapnelLevel = static_cast<eShrapnelLevel>(Clamp<int>(TNTShrapnelLevel, slNone, slAll)); |