diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-26 14:31:52 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-26 14:31:52 +0200 |
commit | 749c6092d3bff2cf6c22b6b3299d6883b070b08a (patch) | |
tree | 3c1e790e6bbdd3b03eb379dbe9ba7c3eeeb281f9 | |
parent | Improved searching for spawn. (diff) | |
download | cuberite-749c6092d3bff2cf6c22b6b3299d6883b070b08a.tar cuberite-749c6092d3bff2cf6c22b6b3299d6883b070b08a.tar.gz cuberite-749c6092d3bff2cf6c22b6b3299d6883b070b08a.tar.bz2 cuberite-749c6092d3bff2cf6c22b6b3299d6883b070b08a.tar.lz cuberite-749c6092d3bff2cf6c22b6b3299d6883b070b08a.tar.xz cuberite-749c6092d3bff2cf6c22b6b3299d6883b070b08a.tar.zst cuberite-749c6092d3bff2cf6c22b6b3299d6883b070b08a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/WorldStorage/MapSerializer.cpp | 18 | ||||
-rw-r--r-- | src/WorldStorage/MapSerializer.h | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp index 012fc52f3..4a913c81a 100644 --- a/src/WorldStorage/MapSerializer.cpp +++ b/src/WorldStorage/MapSerializer.cpp @@ -130,14 +130,14 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT) } int CurrLine = a_NBT.FindChildByName(Data, "scale"); - if (CurrLine >= 0) + if ((CurrLine >= 0) && (a_NBT.GetType(CurrLine) == TAG_Byte)) { - unsigned int Scale = a_NBT.GetByte(CurrLine); + unsigned int Scale = (unsigned int)a_NBT.GetByte(CurrLine); m_Map->SetScale(Scale); } CurrLine = a_NBT.FindChildByName(Data, "dimension"); - if (CurrLine >= 0) + if ((CurrLine >= 0) && (a_NBT.GetType(CurrLine) == TAG_Byte)) { eDimension Dimension = (eDimension) a_NBT.GetByte(CurrLine); @@ -149,9 +149,9 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT) } CurrLine = a_NBT.FindChildByName(Data, "width"); - if (CurrLine >= 0) + if ((CurrLine >= 0) && (a_NBT.GetType(CurrLine) == TAG_Short)) { - unsigned int Width = a_NBT.GetShort(CurrLine); + unsigned int Width = (unsigned int)a_NBT.GetShort(CurrLine); if (Width != 128) { return false; @@ -160,9 +160,9 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT) } CurrLine = a_NBT.FindChildByName(Data, "height"); - if (CurrLine >= 0) + if ((CurrLine >= 0) && (a_NBT.GetType(CurrLine) == TAG_Short)) { - unsigned int Height = a_NBT.GetShort(CurrLine); + unsigned int Height = (unsigned int)a_NBT.GetShort(CurrLine); if (Height >= 256) { return false; @@ -171,14 +171,14 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT) } CurrLine = a_NBT.FindChildByName(Data, "xCenter"); - if (CurrLine >= 0) + if ((CurrLine >= 0) && (a_NBT.GetType(CurrLine) == TAG_Int)) { int CenterX = a_NBT.GetInt(CurrLine); m_Map->m_CenterX = CenterX; } CurrLine = a_NBT.FindChildByName(Data, "zCenter"); - if (CurrLine >= 0) + if ((CurrLine >= 0) && (a_NBT.GetType(CurrLine) == TAG_Int)) { int CenterZ = a_NBT.GetInt(CurrLine); m_Map->m_CenterZ = CenterZ; diff --git a/src/WorldStorage/MapSerializer.h b/src/WorldStorage/MapSerializer.h index 4fa40f6f9..e13a75c8f 100644 --- a/src/WorldStorage/MapSerializer.h +++ b/src/WorldStorage/MapSerializer.h @@ -28,10 +28,10 @@ public: cMapSerializer(const AString& a_WorldName, cMap * a_Map); - /** Try to load the scoreboard */ + /** Try to load the map */ bool Load(void); - /** Try to save the scoreboard */ + /** Try to save the map */ bool Save(void); |