summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-02-13 20:36:24 +0100
committerandrew <xdotftw@gmail.com>2014-02-13 20:36:24 +0100
commit32b465b8e1e1a6fa9e966a1376209f292331d4ae (patch)
treeca6e9abef0390dbd377c3cbf77fd25b34bade078 /src/World.cpp
parentImplementation of in-game maps (diff)
downloadcuberite-32b465b8e1e1a6fa9e966a1376209f292331d4ae.tar
cuberite-32b465b8e1e1a6fa9e966a1376209f292331d4ae.tar.gz
cuberite-32b465b8e1e1a6fa9e966a1376209f292331d4ae.tar.bz2
cuberite-32b465b8e1e1a6fa9e966a1376209f292331d4ae.tar.lz
cuberite-32b465b8e1e1a6fa9e966a1376209f292331d4ae.tar.xz
cuberite-32b465b8e1e1a6fa9e966a1376209f292331d4ae.tar.zst
cuberite-32b465b8e1e1a6fa9e966a1376209f292331d4ae.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/World.cpp b/src/World.cpp
index f8c1091f0..a308778df 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -11,7 +11,9 @@
#include "ChunkMap.h"
#include "Generating/ChunkDesc.h"
#include "OSSupport/Timer.h"
+
#include "WorldStorage/ScoreboardSerializer.h"
+#include "WorldStorage/MapSerializer.h"
// Entities (except mobs):
#include "Entities/ExpOrb.h"
@@ -261,6 +263,8 @@ cWorld::cWorld(const AString & a_WorldName) :
// Load the scoreboard
cScoreboardSerializer Serializer(m_WorldName, &m_Scoreboard);
Serializer.Load();
+
+ LoadMapData();
}
@@ -284,6 +288,8 @@ cWorld::~cWorld()
cScoreboardSerializer Serializer(m_WorldName, &m_Scoreboard);
Serializer.Save();
+ SaveMapData();
+
delete m_ChunkMap;
}
@@ -2945,6 +2951,54 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c
+
+void cWorld::LoadMapData(void)
+{
+ cIDCountSerializer IDSerializer(GetName());
+
+ IDSerializer.Load();
+
+ unsigned int MapCount = IDSerializer.GetMapCount();
+
+ m_MapData.clear();
+
+ for (unsigned int i = 0; i < MapCount; ++i)
+ {
+ cMap Map(i, this);
+
+ cMapSerializer Serializer(GetName(), &Map);
+
+ Serializer.Load();
+
+ m_MapData.push_back(Map);
+ }
+}
+
+
+
+
+
+void cWorld::SaveMapData(void)
+{
+ cIDCountSerializer IDSerializer(GetName());
+
+ IDSerializer.SetMapCount(m_MapData.size());
+
+ IDSerializer.Save();
+
+ for (cMapList::iterator it = m_MapData.begin(); it != m_MapData.end(); ++it)
+ {
+ cMap & Map = *it;
+
+ cMapSerializer Serializer(GetName(), &Map);
+
+ Serializer.Save();
+ }
+}
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cWorld::cTaskSaveAllChunks: