summaryrefslogtreecommitdiffstats
path: root/src/Root.cpp
diff options
context:
space:
mode:
authorLane Kolbly <lane@rscheme.org>2017-09-07 14:41:16 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-07 14:41:16 +0200
commitb12f4ef7d58cfe4d815feb2db1f88f223c7f2a61 (patch)
treec7e2a8db5676c8599ce76b212491dd35fd883c1c /src/Root.cpp
parentLighting now generally consistent with vanilla (#3988) (diff)
downloadcuberite-b12f4ef7d58cfe4d815feb2db1f88f223c7f2a61.tar
cuberite-b12f4ef7d58cfe4d815feb2db1f88f223c7f2a61.tar.gz
cuberite-b12f4ef7d58cfe4d815feb2db1f88f223c7f2a61.tar.bz2
cuberite-b12f4ef7d58cfe4d815feb2db1f88f223c7f2a61.tar.lz
cuberite-b12f4ef7d58cfe4d815feb2db1f88f223c7f2a61.tar.xz
cuberite-b12f4ef7d58cfe4d815feb2db1f88f223c7f2a61.tar.zst
cuberite-b12f4ef7d58cfe4d815feb2db1f88f223c7f2a61.zip
Diffstat (limited to '')
-rw-r--r--src/Root.cpp48
1 files changed, 34 insertions, 14 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index 3e30d8a07..38c95f822 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -396,16 +396,20 @@ 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_the_end");
- m_pDefaultWorld = new cWorld("world");
+ a_Settings.AddValue("WorldPaths", "world", "world");
+ a_Settings.AddValue("WorldPaths", "world_nether", "world_nether");
+ a_Settings.AddValue("WorldPaths", "world_the_end", "world_the_end");
+ m_pDefaultWorld = new cWorld("world", "world");
m_WorldsByName["world"] = m_pDefaultWorld;
- m_WorldsByName["world_nether"] = new cWorld("world_nether", dimNether, "world");
- m_WorldsByName["world_the_end"] = new cWorld("world_the_end", dimEnd, "world");
+ m_WorldsByName["world_nether"] = new cWorld("world_nether", "world_nether", dimNether, "world");
+ m_WorldsByName["world_the_end"] = new cWorld("world_the_end", "world_the_end", dimEnd, "world");
return;
}
// First get the default world
AString DefaultWorldName = a_Settings.GetValueSet("Worlds", "DefaultWorld", "world");
- m_pDefaultWorld = new cWorld(DefaultWorldName.c_str());
+ AString DefaultWorldPath = a_Settings.GetValueSet("WorldPaths", DefaultWorldName, DefaultWorldName);
+ m_pDefaultWorld = new cWorld(DefaultWorldName.c_str(), DefaultWorldPath.c_str());
m_WorldsByName[ DefaultWorldName ] = m_pDefaultWorld;
auto Worlds = a_Settings.GetValues("Worlds");
@@ -453,10 +457,15 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn
FoundAdditionalWorlds = true;
cWorld * NewWorld;
AString LowercaseName = StrToLower(WorldName);
+ AString WorldPath = a_Settings.GetValueSet("WorldPaths", WorldName, WorldName);
AString NetherAppend = "_nether";
AString EndAppend1 = "_the_end";
AString EndAppend2 = "_end";
+ // The default world is an overworld with no links
+ eDimension Dimension = dimOverworld;
+ AString LinkTo = "";
+
// if the world is called x_nether
if ((LowercaseName.size() > NetherAppend.size()) && (LowercaseName.substr(LowercaseName.size() - NetherAppend.size()) == NetherAppend))
{
@@ -464,12 +473,12 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn
// 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() - NetherAppend.size());
+ LinkTo = WorldName.substr(0, WorldName.size() - NetherAppend.size());
if (GetWorld(LinkTo) == nullptr)
{
LinkTo = DefaultWorldName;
}
- NewWorld = new cWorld(WorldName.c_str(), dimNether, LinkTo);
+ Dimension = dimNether;
}
// if the world is called x_the_end
else if ((LowercaseName.size() > EndAppend1.size()) && (LowercaseName.substr(LowercaseName.size() - EndAppend1.size()) == EndAppend1))
@@ -478,12 +487,12 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn
// 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());
+ LinkTo = WorldName.substr(0, WorldName.size() - EndAppend1.size());
if (GetWorld(LinkTo) == nullptr)
{
LinkTo = DefaultWorldName;
}
- NewWorld = new cWorld(WorldName.c_str(), dimEnd, LinkTo);
+ Dimension = dimEnd;
}
// if the world is called x_end
else if ((LowercaseName.size() > EndAppend2.size()) && (LowercaseName.substr(LowercaseName.size() - EndAppend2.size()) == EndAppend2))
@@ -492,17 +501,14 @@ void cRoot::LoadWorlds(cSettingsRepositoryInterface & a_Settings, bool a_IsNewIn
// 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() - EndAppend2.size());
+ LinkTo = WorldName.substr(0, WorldName.size() - EndAppend2.size());
if (GetWorld(LinkTo) == nullptr)
{
LinkTo = DefaultWorldName;
}
- NewWorld = new cWorld(WorldName.c_str(), dimEnd, LinkTo);
- }
- else
- {
- NewWorld = new cWorld(WorldName.c_str());
+ Dimension = dimEnd;
}
+ NewWorld = new cWorld(WorldName.c_str(), WorldPath.c_str(), Dimension, LinkTo);
m_WorldsByName[WorldName] = NewWorld;
} // for i - Worlds
@@ -709,6 +715,20 @@ void cRoot::SaveAllChunks(void)
+
+
+void cRoot::SetSavingEnabled(bool a_SavingEnabled)
+{
+ for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr)
+ {
+ itr->second->SetSavingEnabled(a_SavingEnabled);
+ }
+}
+
+
+
+
+
void cRoot::SendPlayerLists(cPlayer * a_DestPlayer)
{
for (const auto & itr : m_WorldsByName)