summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-02-02 17:13:51 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-02-02 17:13:51 +0100
commit22bc6db52ad7e9cb9e56a791b48ee9f4e2798c12 (patch)
tree0341ad8386e054cb8776197eed2a7609aa814a17
parentf8a66ee6b699d02775a10ac0a5ce355a90c27939 (diff)
downloadMinedMap-22bc6db52ad7e9cb9e56a791b48ee9f4e2798c12.tar
MinedMap-22bc6db52ad7e9cb9e56a791b48ee9f4e2798c12.zip
Chunk: zero data buffers to avoid using unitialized data
-rw-r--r--src/World/Chunk.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/World/Chunk.cpp b/src/World/Chunk.cpp
index 17b5406..cdc2806 100644
--- a/src/World/Chunk.cpp
+++ b/src/World/Chunk.cpp
@@ -117,7 +117,10 @@ void Chunk::analyzeChunk() {
blockSkyLight.reset(new uint8_t[maxY * SIZE * SIZE / 2]);
blockBlockLight.reset(new uint8_t[maxY * SIZE * SIZE / 2]);
+ std::memset(blockIDs.get(), 0, maxY * SIZE * SIZE);
+ std::memset(blockData.get(), 0, maxY * SIZE * SIZE / 2);
std::memset(blockSkyLight.get(), 0xff, maxY * SIZE * SIZE / 2);
+ std::memset(blockBlockLight.get(), 0, maxY * SIZE * SIZE / 2);
for (auto &section : *sections) {