diff options
Diffstat (limited to 'src/ChunkData.h')
-rw-r--r-- | src/ChunkData.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ChunkData.h b/src/ChunkData.h index 16fcc4d37..08f1603bb 100644 --- a/src/ChunkData.h +++ b/src/ChunkData.h @@ -7,6 +7,7 @@ #include "ChunkDef.h" +#include "AllocationPool.h" @@ -20,7 +21,9 @@ class cChunkData { public: - cChunkData(); + struct sChunkSection; + + cChunkData(cAllocationPool<cChunkData::sChunkSection, 1600>& a_Pool); ~cChunkData(); #if __cplusplus < 201103L @@ -54,6 +57,13 @@ public: void SetBlockLight (const NIBBLETYPE * a_src); void SetSkyLight (const NIBBLETYPE * a_src); + struct sChunkSection { + BLOCKTYPE m_BlockTypes [CHUNK_SECTION_HEIGHT * 16 * 16] ; + NIBBLETYPE m_BlockMeta [CHUNK_SECTION_HEIGHT * 16 * 16 / 2]; + NIBBLETYPE m_BlockLight [CHUNK_SECTION_HEIGHT * 16 * 16 / 2]; + NIBBLETYPE m_BlockSkyLight[CHUNK_SECTION_HEIGHT * 16 * 16 / 2]; + }; + private: static const size_t CHUNK_SECTION_HEIGHT = 16; @@ -63,20 +73,15 @@ private: // auto_ptr style interface for memory management mutable bool IsOwner; #endif - - struct sChunkSection { - BLOCKTYPE m_BlockTypes [CHUNK_SECTION_HEIGHT * 16 * 16] ; - NIBBLETYPE m_BlockMeta [CHUNK_SECTION_HEIGHT * 16 * 16 / 2]; - NIBBLETYPE m_BlockLight [CHUNK_SECTION_HEIGHT * 16 * 16 / 2]; - NIBBLETYPE m_BlockSkyLight[CHUNK_SECTION_HEIGHT * 16 * 16 / 2]; - }; - + sChunkSection *m_Sections[CHUNK_SECTION_COUNT]; sChunkSection * Allocate() const; void Free(sChunkSection * ptr) const; void ZeroSection(sChunkSection * ptr) const; + + cAllocationPool<cChunkData::sChunkSection, 1600>& m_Pool; }; |