summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-02-17 15:27:12 +0100
committerandrew <xdotftw@gmail.com>2014-02-17 15:27:12 +0100
commit3b24bc870bb39a8b8812ed307250e1188b9ff788 (patch)
tree8b6cf830e06a0fe6bd1eb8769ba571f9316a4707 /src/WorldStorage
parentcMap::UpdateRadius (diff)
downloadcuberite-3b24bc870bb39a8b8812ed307250e1188b9ff788.tar
cuberite-3b24bc870bb39a8b8812ed307250e1188b9ff788.tar.gz
cuberite-3b24bc870bb39a8b8812ed307250e1188b9ff788.tar.bz2
cuberite-3b24bc870bb39a8b8812ed307250e1188b9ff788.tar.lz
cuberite-3b24bc870bb39a8b8812ed307250e1188b9ff788.tar.xz
cuberite-3b24bc870bb39a8b8812ed307250e1188b9ff788.tar.zst
cuberite-3b24bc870bb39a8b8812ed307250e1188b9ff788.zip
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/MapSerializer.cpp11
-rw-r--r--src/WorldStorage/MapSerializer.h7
2 files changed, 14 insertions, 4 deletions
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp
index 6dab19d4f..0bbe71a60 100644
--- a/src/WorldStorage/MapSerializer.cpp
+++ b/src/WorldStorage/MapSerializer.cpp
@@ -223,7 +223,11 @@ bool cIDCountSerializer::Load(void)
int CurrLine = NBT.FindChildByName(0, "map");
if (CurrLine >= 0)
{
- m_MapCount = (int)NBT.GetShort(CurrLine);
+ m_MapCount = (int)NBT.GetShort(CurrLine) + 1;
+ }
+ else
+ {
+ m_MapCount = 0;
}
return true;
@@ -237,7 +241,10 @@ bool cIDCountSerializer::Save(void)
{
cFastNBTWriter Writer;
- Writer.AddShort("map", m_MapCount);
+ if (m_MapCount > 0)
+ {
+ Writer.AddShort("map", m_MapCount - 1);
+ }
Writer.Finish();
diff --git a/src/WorldStorage/MapSerializer.h b/src/WorldStorage/MapSerializer.h
index d9da107bc..296cc92c8 100644
--- a/src/WorldStorage/MapSerializer.h
+++ b/src/WorldStorage/MapSerializer.h
@@ -27,10 +27,10 @@ public:
cMapSerializer(const AString& a_WorldName, cMap * a_Map);
- /// Try to load the scoreboard
+ /** Try to load the scoreboard */
bool Load(void);
- /// Try to save the scoreboard
+ /** Try to save the scoreboard */
bool Save(void);
@@ -56,8 +56,10 @@ public:
cIDCountSerializer(const AString & a_WorldName);
+ /** Try to load the ID counts */
bool Load(void);
+ /** Try to save the ID counts */
bool Save(void);
inline unsigned int GetMapCount(void) const { return m_MapCount; }
@@ -70,6 +72,7 @@ private:
AString m_Path;
unsigned int m_MapCount;
+
};