Skip to content

Commit

Permalink
Changed world_end to world_the_end #3531 (#3538)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bond-009 authored and madmaxoft committed Feb 24, 2017
1 parent f59bd02 commit ca3aa4c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
37 changes: 26 additions & 11 deletions src/Root.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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.
*/
Expand All @@ -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))
Expand All @@ -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;
Expand Down
9 changes: 7 additions & 2 deletions src/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit ca3aa4c

Please sign in to comment.