summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-02-14 15:21:16 +0100
committerandrew <xdotftw@gmail.com>2014-02-14 15:21:16 +0100
commit5b92b877bcc0c5072dbea98b6c54106f954aa758 (patch)
treefa91320608d925cac74804fd44597198e2f3760e /src/WorldStorage
parentIDCount Serialization (diff)
downloadcuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.gz
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.bz2
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.lz
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.xz
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.tar.zst
cuberite-5b92b877bcc0c5072dbea98b6c54106f954aa758.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/MapSerializer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp
index aab4c7816..6dab19d4f 100644
--- a/src/WorldStorage/MapSerializer.cpp
+++ b/src/WorldStorage/MapSerializer.cpp
@@ -111,7 +111,6 @@ void cMapSerializer::SaveMapToNBT(cFastNBTWriter & a_Writer)
a_Writer.AddInt("xCenter", m_Map->GetCenterX());
a_Writer.AddInt("zCenter", m_Map->GetCenterZ());
- // Potential bug - The internal representation may change
const cMap::cColorList & Data = m_Map->GetData();
a_Writer.AddByteArray("colors", (char *) Data.data(), Data.size());
@@ -134,7 +133,7 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT)
if (CurrLine >= 0)
{
unsigned int Scale = a_NBT.GetByte(CurrLine);
- m_Map->m_Scale = Scale;
+ m_Map->SetScale(Scale);
}
CurrLine = a_NBT.FindChildByName(Data, "dimension");
@@ -176,7 +175,11 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT)
unsigned int NumPixels = m_Map->GetNumPixels();
m_Map->m_Data.resize(NumPixels);
- // TODO xdot: Parse the byte array.
+ CurrLine = a_NBT.FindChildByName(Data, "colors");
+ if ((CurrLine >= 0) && (a_NBT.GetType(CurrLine) == TAG_ByteArray))
+ {
+ memcpy(m_Map->m_Data.data(), a_NBT.GetData(CurrLine), NumPixels);
+ }
return true;
}