summaryrefslogtreecommitdiffstats
path: root/src/World
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-02-01 04:14:42 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-02-01 04:14:42 +0100
commit8a8a41a800dfe9bdcab934d6b53d9c6defd4a457 (patch)
treef9d40b96ee3413cbe7a402a4b4abad607b2a1c7c /src/World
parentfc1fc8fbbc9dd9534f40de348210ea66b6defe42 (diff)
downloadMinedMap-8a8a41a800dfe9bdcab934d6b53d9c6defd4a457.tar
MinedMap-8a8a41a800dfe9bdcab934d6b53d9c6defd4a457.zip
Parse chunk data on demand
Diffstat (limited to 'src/World')
-rw-r--r--src/World/Chunk.cpp1
-rw-r--r--src/World/Chunk.hpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/World/Chunk.cpp b/src/World/Chunk.cpp
index fb46466..db286ee 100644
--- a/src/World/Chunk.cpp
+++ b/src/World/Chunk.cpp
@@ -82,7 +82,6 @@ Chunk::Chunk(uint8_t *buffer, size_t buflen) {
if (format != 2)
throw std::invalid_argument("unknown chunk format");
- UniqueCPtr<uint8_t[]> data;
size_t len;
std::tie(data, len) = inflateChunk(buffer+5, size-1);
diff --git a/src/World/Chunk.hpp b/src/World/Chunk.hpp
index 3ed6cf4..5b0ecdb 100644
--- a/src/World/Chunk.hpp
+++ b/src/World/Chunk.hpp
@@ -43,6 +43,8 @@ public:
static const size_t SIZE = 16;
private:
+ UniqueCPtr<uint8_t[]> data;
+
static std::pair<UniqueCPtr<uint8_t[]>, size_t> inflateChunk(uint8_t *data, size_t len);
std::shared_ptr<const NBT::ListTag<NBT::CompoundTag>> sections;