diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-04-18 21:29:39 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-04-19 11:06:52 +0200 |
commit | 9b60ee6e439b55dd87179db0d24594f3c4debf6c (patch) | |
tree | 92e20fb6b24e2f0d7b8af190b49cfb71838f1f90 /src/World.cpp | |
parent | Proper fix for #3136 (#3143) (diff) | |
download | cuberite-9b60ee6e439b55dd87179db0d24594f3c4debf6c.tar cuberite-9b60ee6e439b55dd87179db0d24594f3c4debf6c.tar.gz cuberite-9b60ee6e439b55dd87179db0d24594f3c4debf6c.tar.bz2 cuberite-9b60ee6e439b55dd87179db0d24594f3c4debf6c.tar.lz cuberite-9b60ee6e439b55dd87179db0d24594f3c4debf6c.tar.xz cuberite-9b60ee6e439b55dd87179db0d24594f3c4debf6c.tar.zst cuberite-9b60ee6e439b55dd87179db0d24594f3c4debf6c.zip |
Diffstat (limited to 'src/World.cpp')
-rw-r--r-- | src/World.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/World.cpp b/src/World.cpp index 0649d2bb2..d06f22d1b 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -530,38 +530,36 @@ 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 = ""; + // If we are linked to one or more worlds that do not exist, unlink them cRoot * Root = cRoot::Get(); if (GetDimension() == dimOverworld) { if ((!m_LinkedNetherWorldName.empty()) && (Root->GetWorld(m_LinkedNetherWorldName) == nullptr)) { - BadWorlds = m_LinkedNetherWorldName; + IniFile.SetValue("LinkedWorlds", "NetherWorldName", ""); + LOG("%s Is linked to a nonexisting nether world called \"%s\". The server has modified \"%s/world.ini\" and removed this invalid link.", + GetName().c_str(), m_LinkedNetherWorldName.c_str(), GetName().c_str()); + m_LinkedNetherWorldName = ""; } if ((!m_LinkedEndWorldName.empty()) && (Root->GetWorld(m_LinkedEndWorldName) == nullptr)) { - if (!(BadWorlds.empty())) - { - BadWorlds += ", "; - } - BadWorlds += m_LinkedEndWorldName; + IniFile.SetValue("LinkedWorlds", "EndWorldName", ""); + LOG("%s Is linked to a nonexisting end world called \"%s\". The server has modified \"%s/world.ini\" and removed this invalid link.", + GetName().c_str(), m_LinkedEndWorldName.c_str(), GetName().c_str()); + m_LinkedEndWorldName = ""; } } else { if ((!m_LinkedOverworldName.empty()) && (Root->GetWorld(m_LinkedOverworldName) == nullptr)) { - BadWorlds = m_LinkedOverworldName; + IniFile.SetValue("LinkedWorlds", "OverworldName", ""); + LOG("%s Is linked to a nonexisting overworld called \"%s\". The server has modified \"%s/world.ini\" and removed this invalid link.", + GetName().c_str(), m_LinkedOverworldName.c_str(), GetName().c_str()); + m_LinkedOverworldName = ""; } } - if (!BadWorlds.empty()) - { - const char * WorldName = m_WorldName.c_str(); - LOGERROR("\n###### ERROR: \"%s\" is linked to the following nonexisting world/s:\n%s\n\nPlease edit %s/world.ini and fix this.\n\nNote that the server started enforcing proper world linkages recently. And people with older configs may naturally get this error. If you just want a working default config and don't mind losing this world, delete the folder \"%s\" and the server will receate one for you. Otherwise edit the world.ini file and fix the invalid linkages.\n\nMore help and info:\nhttps://forum.cuberite.org/thread-2366.html\n######\n", - WorldName, BadWorlds.c_str(), WorldName, WorldName); - cRoot::Get()->StopServer(); - } + // Adjust the enum-backed variables into their respective bounds: |