summaryrefslogtreecommitdiffstats
path: root/src/ChunkDataCallback.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ChunkDataCallback.h')
-rw-r--r--src/ChunkDataCallback.h40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/ChunkDataCallback.h b/src/ChunkDataCallback.h
index e916d6486..0c8b1098f 100644
--- a/src/ChunkDataCallback.h
+++ b/src/ChunkDataCallback.h
@@ -1,11 +1,20 @@
+// ChunkDataCallback.h
+
+// Declares the cChunkDataCallback interface and several trivial descendants, for reading chunk data
+
-#pragma once
+
+#pragma once
+
#include "ChunkData.h"
+
+
+
/** Interface class used for getting data out of a chunk using the GetAllData() function.
Implementation must use the pointers immediately and NOT store any of them for later use
The virtual methods are called in the same order as they're declared here.
@@ -41,6 +50,10 @@ public:
virtual void BlockEntity(cBlockEntity * a_Entity) {UNUSED(a_Entity); };
} ;
+
+
+
+
/** A simple implementation of the cChunkDataCallback interface that collects all block data into a buffer
*/
class cChunkDataCollector :
@@ -59,6 +72,9 @@ protected:
};
+
+
+
/** A simple implementation of the cChunkDataCallback interface that collects all block data into a single buffer
*/
class cChunkDataArrayCollector :
@@ -73,15 +89,18 @@ protected:
virtual void ChunkData(const cChunkData & a_ChunkBuffer) override
{
- a_ChunkBuffer.CopyBlocks(m_BlockData);
- a_ChunkBuffer.CopyMeta(m_BlockData + cChunkDef::NumBlocks);
+ a_ChunkBuffer.CopyBlockTypes(m_BlockData);
+ a_ChunkBuffer.CopyMetas(m_BlockData + cChunkDef::NumBlocks);
a_ChunkBuffer.CopyBlockLight(m_BlockData + 3 * cChunkDef::NumBlocks / 2);
a_ChunkBuffer.CopySkyLight(m_BlockData + 2 * cChunkDef::NumBlocks);
}
};
-/** A simple implementation of the cChunkDataCallback interface that collects all block data into a separate buffers
-*/
+
+
+
+
+/** A simple implementation of the cChunkDataCallback interface that collects all block data into separate buffers */
class cChunkDataSeparateCollector :
public cChunkDataCallback
{
@@ -96,10 +115,13 @@ protected:
virtual void ChunkData(const cChunkData & a_ChunkBuffer) override
{
- a_ChunkBuffer.CopyBlocks(m_BlockTypes);
- a_ChunkBuffer.CopyMeta(m_BlockMetas);
- a_ChunkBuffer.CopyBlockLight(m_BlockLight);
- a_ChunkBuffer.CopySkyLight(m_BlockSkyLight);
+ a_ChunkBuffer.CopyBlockTypes(m_BlockTypes);
+ a_ChunkBuffer.CopyMetas(m_BlockMetas);
+ a_ChunkBuffer.CopyBlockLight(m_BlockLight);
+ a_ChunkBuffer.CopySkyLight(m_BlockSkyLight);
}
} ;
+
+
+