summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft <madmaxoft@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-11-13 16:58:27 +0100
committermadmaxoft <madmaxoft@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-11-13 16:58:27 +0100
commit76ab9fc0a869c1df47af7939bf9b885bd4de5779 (patch)
tree3d31e019ca5ce6f8354531383e46787675a6861b
parentFixed a valgrind error in lighting thread (uninitialized var value) (diff)
downloadcuberite-76ab9fc0a869c1df47af7939bf9b885bd4de5779.tar
cuberite-76ab9fc0a869c1df47af7939bf9b885bd4de5779.tar.gz
cuberite-76ab9fc0a869c1df47af7939bf9b885bd4de5779.tar.bz2
cuberite-76ab9fc0a869c1df47af7939bf9b885bd4de5779.tar.lz
cuberite-76ab9fc0a869c1df47af7939bf9b885bd4de5779.tar.xz
cuberite-76ab9fc0a869c1df47af7939bf9b885bd4de5779.tar.zst
cuberite-76ab9fc0a869c1df47af7939bf9b885bd4de5779.zip
-rw-r--r--source/WorldStorage/WSSAnvil.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/WorldStorage/WSSAnvil.cpp b/source/WorldStorage/WSSAnvil.cpp
index e12c3f0d9..e588f53e7 100644
--- a/source/WorldStorage/WSSAnvil.cpp
+++ b/source/WorldStorage/WSSAnvil.cpp
@@ -66,6 +66,13 @@ public:
{
m_Writer.EndList();
}
+
+ // If light not valid, reset it to all zeroes:
+ if (!m_IsLightValid)
+ {
+ memset(m_BlockLight, 0, sizeof(m_BlockLight));
+ memset(m_BlockSkyLight, 0, sizeof(m_BlockSkyLight));
+ }
}
@@ -593,8 +600,11 @@ bool cWSSAnvil::SaveChunkToNBT(const cChunkCoords & a_Chunk, cFastNBTWriter & a_
Serializer.Finish(); // Close NBT tags
// Save biomes, both MCS (IntArray) and MC-vanilla (ByteArray):
- a_Writer.AddByteArray("Biomes", (const char *)(Serializer.m_VanillaBiomes), ARRAYCOUNT(Serializer.m_VanillaBiomes));
- a_Writer.AddIntArray ("MCSBiomes", (const int *)(Serializer.m_Biomes), ARRAYCOUNT(Serializer.m_Biomes));
+ if (Serializer.m_BiomesAreValid)
+ {
+ a_Writer.AddByteArray("Biomes", (const char *)(Serializer.m_VanillaBiomes), ARRAYCOUNT(Serializer.m_VanillaBiomes));
+ a_Writer.AddIntArray ("MCSBiomes", (const int *)(Serializer.m_Biomes), ARRAYCOUNT(Serializer.m_Biomes));
+ }
// Save blockdata:
a_Writer.BeginList("Sections", TAG_Compound);