diff options
Diffstat (limited to '')
-rw-r--r-- | src/Root.cpp | 37 | ||||
-rw-r--r-- | src/World.cpp | 9 |
2 files changed, 33 insertions, 13 deletions
diff --git a/src/Root.cpp b/src/Root.cpp index 508d0a648..30644a741 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -382,11 +382,11 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn { a_Settings.AddValue("Worlds", "DefaultWorld", "world"); a_Settings.AddValue("Worlds", "World", "world_nether"); - a_Settings.AddValue("Worlds", "World", "world_end"); + a_Settings.AddValue("Worlds", "World", "world_the_end"); m_pDefaultWorld = new cWorld("world"); m_WorldsByName["world"] = m_pDefaultWorld; m_WorldsByName["world_nether"] = new cWorld("world_nether", dimNether, "world"); - m_WorldsByName["world_end"] = new cWorld("world_end", dimEnd, "world"); + m_WorldsByName["world_the_end"] = new cWorld("world_the_end", dimEnd, "world"); return; } @@ -411,15 +411,15 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn - If a world called x exists, set it as x_nether's overworld. - Otherwise set the default world as x_nether's overworld. - - If the world name is x_end, create a world.ini with the dimension type "end". - - If a world called x exists, set it as x_end's overworld. - - Otherwise set the default world as x_end's overworld. + - If the world name is x_the_end or x_end, create a world.ini with the dimension type "end". + - If a world called x exists, set it as x_the_end's overworld. + - Otherwise set the default world as x_the_end's overworld. - - If the world name is x (and doesn't end with _end or _nether) + - If the world name is x (and doesn't end with _the_end, _end or _nether) - Create a world.ini with a dimension type of "overworld". - If a world called x_nether exists, set it as x's nether world. - Otherwise set x's nether world to blank.h - - If a world called x_end exists, set it as x's end world. + - If a world called x_the_end or x_end exists, set it as x's end world. - Otherwise set x's nether world to blank. */ @@ -440,8 +440,9 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn FoundAdditionalWorlds = true; cWorld * NewWorld; AString LowercaseName = StrToLower(WorldName); - AString NetherAppend="_nether"; - AString EndAppend="_end"; + AString NetherAppend = "_nether"; + AString EndAppend1 = "_the_end"; + AString EndAppend2 = "_end"; // if the world is called x_nether if ((LowercaseName.size() > NetherAppend.size()) && (LowercaseName.substr(LowercaseName.size() - NetherAppend.size()) == NetherAppend)) @@ -457,14 +458,28 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn } NewWorld = new cWorld(WorldName.c_str(), dimNether, LinkTo); } + // if the world is called x_the_end + else if ((LowercaseName.size() > EndAppend1.size()) && (LowercaseName.substr(LowercaseName.size() - EndAppend1.size()) == EndAppend1)) + { + // The world is called x_the_end, see if a world called x exists. If yes, choose it as the linked world, + // otherwise, choose the default world as the linked world. + // As before, any ini settings will completely override this if an ini is already present. + + AString LinkTo = WorldName.substr(0, WorldName.size() - EndAppend1.size()); + if (GetWorld(LinkTo) == nullptr) + { + LinkTo = DefaultWorldName; + } + NewWorld = new cWorld(WorldName.c_str(), dimEnd, LinkTo); + } // if the world is called x_end - else if ((LowercaseName.size() > EndAppend.size()) && (LowercaseName.substr(LowercaseName.size() - EndAppend.size()) == EndAppend)) + else if ((LowercaseName.size() > EndAppend2.size()) && (LowercaseName.substr(LowercaseName.size() - EndAppend2.size()) == EndAppend2)) { // The world is called x_end, see if a world called x exists. If yes, choose it as the linked world, // otherwise, choose the default world as the linked world. // As before, any ini settings will completely override this if an ini is already present. - AString LinkTo = WorldName.substr(0, WorldName.size() - EndAppend.size()); + AString LinkTo = WorldName.substr(0, WorldName.size() - EndAppend2.size()); if (GetWorld(LinkTo) == nullptr) { LinkTo = DefaultWorldName; diff --git a/src/World.cpp b/src/World.cpp index b07bc5468..7c16ae980 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -501,15 +501,20 @@ void cWorld::Start(cDeadlockDetect & a_DeadlockDetect) if (GetDimension() == dimOverworld) { AString MyNetherName = GetName() + "_nether"; - AString MyEndName = GetName() + "_end"; + AString MyEndName = GetName() + "_the_end"; if (cRoot::Get()->GetWorld(MyNetherName) == nullptr) { MyNetherName = ""; } if (cRoot::Get()->GetWorld(MyEndName) == nullptr) { - MyEndName = ""; + MyEndName = GetName() + "_end"; + if (cRoot::Get()->GetWorld(MyEndName) == nullptr) + { + MyEndName = ""; + } } + m_LinkedNetherWorldName = IniFile.GetValueSet("LinkedWorlds", "NetherWorldName", MyNetherName); m_LinkedEndWorldName = IniFile.GetValueSet("LinkedWorlds", "EndWorldName", MyEndName); } |