parent
f59bd02e0d
commit
ca3aa4ca06
37
src/Root.cpp
37
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", "DefaultWorld", "world");
|
||||||
a_Settings.AddValue("Worlds", "World", "world_nether");
|
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_pDefaultWorld = new cWorld("world");
|
||||||
m_WorldsByName["world"] = m_pDefaultWorld;
|
m_WorldsByName["world"] = m_pDefaultWorld;
|
||||||
m_WorldsByName["world_nether"] = new cWorld("world_nether", dimNether, "world");
|
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;
|
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.
|
- If a world called x exists, set it as x_nether's overworld.
|
||||||
- Otherwise set the default world 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 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_end's overworld.
|
- If a world called x exists, set it as x_the_end's overworld.
|
||||||
- Otherwise set the default world as x_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".
|
- Create a world.ini with a dimension type of "overworld".
|
||||||
- If a world called x_nether exists, set it as x's nether world.
|
- If a world called x_nether exists, set it as x's nether world.
|
||||||
- Otherwise set x's nether world to blank.h
|
- 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.
|
- Otherwise set x's nether world to blank.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -440,8 +440,9 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn
|
|||||||
FoundAdditionalWorlds = true;
|
FoundAdditionalWorlds = true;
|
||||||
cWorld * NewWorld;
|
cWorld * NewWorld;
|
||||||
AString LowercaseName = StrToLower(WorldName);
|
AString LowercaseName = StrToLower(WorldName);
|
||||||
AString NetherAppend="_nether";
|
AString NetherAppend = "_nether";
|
||||||
AString EndAppend="_end";
|
AString EndAppend1 = "_the_end";
|
||||||
|
AString EndAppend2 = "_end";
|
||||||
|
|
||||||
// if the world is called x_nether
|
// if the world is called x_nether
|
||||||
if ((LowercaseName.size() > NetherAppend.size()) && (LowercaseName.substr(LowercaseName.size() - NetherAppend.size()) == NetherAppend))
|
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);
|
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
|
// 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,
|
// 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.
|
// otherwise, choose the default world as the linked world.
|
||||||
// As before, any ini settings will completely override this if an ini is already present.
|
// 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)
|
if (GetWorld(LinkTo) == nullptr)
|
||||||
{
|
{
|
||||||
LinkTo = DefaultWorldName;
|
LinkTo = DefaultWorldName;
|
||||||
|
@ -501,15 +501,20 @@ void cWorld::Start(cDeadlockDetect & a_DeadlockDetect)
|
|||||||
if (GetDimension() == dimOverworld)
|
if (GetDimension() == dimOverworld)
|
||||||
{
|
{
|
||||||
AString MyNetherName = GetName() + "_nether";
|
AString MyNetherName = GetName() + "_nether";
|
||||||
AString MyEndName = GetName() + "_end";
|
AString MyEndName = GetName() + "_the_end";
|
||||||
if (cRoot::Get()->GetWorld(MyNetherName) == nullptr)
|
if (cRoot::Get()->GetWorld(MyNetherName) == nullptr)
|
||||||
{
|
{
|
||||||
MyNetherName = "";
|
MyNetherName = "";
|
||||||
}
|
}
|
||||||
if (cRoot::Get()->GetWorld(MyEndName) == nullptr)
|
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_LinkedNetherWorldName = IniFile.GetValueSet("LinkedWorlds", "NetherWorldName", MyNetherName);
|
||||||
m_LinkedEndWorldName = IniFile.GetValueSet("LinkedWorlds", "EndWorldName", MyEndName);
|
m_LinkedEndWorldName = IniFile.GetValueSet("LinkedWorlds", "EndWorldName", MyEndName);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user