summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/BlockArea.h1
-rw-r--r--src/ChunkBuffer.h63
-rw-r--r--src/ChunkDataCallback.h105
-rw-r--r--src/ChunkDef.h40
-rw-r--r--src/ChunkMap.h3
-rw-r--r--src/ChunkSender.h2
-rw-r--r--src/WorldStorage/NBTChunkSerializer.h2
-rw-r--r--src/WorldStorage/WSSCompact.h2
8 files changed, 111 insertions, 107 deletions
diff --git a/src/BlockArea.h b/src/BlockArea.h
index 50c28aaf2..9c01719c3 100644
--- a/src/BlockArea.h
+++ b/src/BlockArea.h
@@ -14,6 +14,7 @@
#include "ForEachChunkProvider.h"
#include "Vector3.h"
+#include "ChunkDataCallback.h"
diff --git a/src/ChunkBuffer.h b/src/ChunkBuffer.h
index bd178beaa..266df2332 100644
--- a/src/ChunkBuffer.h
+++ b/src/ChunkBuffer.h
@@ -275,68 +275,5 @@ private:
-/** A simple implementation of the cChunkDataCallback interface that collects all block data into a buffer
-*/
-class cChunkBufferCollector :
- public cChunkDataCallback
-{
-public:
-
- cChunkBuffer m_BlockData;
-
-protected:
-
- virtual void ChunkBuffer(const cChunkBuffer & a_BlockData) override
- {
- m_BlockData = a_BlockData.Copy();
- }
-};
-
-
-/** A simple implementation of the cChunkDataCallback interface that collects all block data into a single buffer
-*/
-class cChunkDataCollector :
-public cChunkDataCallback
-{
-public:
-
- // Must be unsigned char instead of BLOCKTYPE or NIBBLETYPE, because it houses both.
- unsigned char m_BlockData[cChunkDef::BlockDataSize];
-
-protected:
-
- virtual void ChunkBuffer(const cChunkBuffer & a_ChunkBuffer) override
- {
- a_ChunkBuffer.CopyBlocks(m_BlockData);
- a_ChunkBuffer.CopyMeta(m_BlockData + cChunkDef::NumBlocks);
- a_ChunkBuffer.CopyLight(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
-*/
-class cChunkDataSeparateCollector :
-public cChunkDataCallback
-{
-public:
-
- cChunkDef::BlockTypes m_BlockTypes;
- cChunkDef::BlockNibbles m_BlockMetas;
- cChunkDef::BlockNibbles m_BlockLight;
- cChunkDef::BlockNibbles m_BlockSkyLight;
-
-protected:
-
- virtual void ChunkBuffer(const cChunkBuffer & a_ChunkBuffer) override
- {
- a_ChunkBuffer.CopyBlocks(m_BlockTypes);
- a_ChunkBuffer.CopyMeta(m_BlockMetas);
- a_ChunkBuffer.CopyLight(m_BlockLight);
- a_ChunkBuffer.CopySkyLight(m_BlockSkyLight);
- }
-} ;
-
-
diff --git a/src/ChunkDataCallback.h b/src/ChunkDataCallback.h
new file mode 100644
index 000000000..76c45040e
--- /dev/null
+++ b/src/ChunkDataCallback.h
@@ -0,0 +1,105 @@
+
+
+#pragma once
+
+
+#include "ChunkBuffer.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.
+*/
+class cChunkDataCallback abstract
+{
+public:
+
+ virtual ~cChunkDataCallback() {}
+
+ /** Called before any other callbacks to inform of the current coords
+ (only in processes where multiple chunks can be processed, such as cWorld::ForEachChunkInRect()).
+ If false is returned, the chunk is skipped.
+ */
+ virtual bool Coords(int a_ChunkX, int a_ChunkZ) { UNUSED(a_ChunkX); UNUSED(a_ChunkZ); return true; };
+
+ /// Called once to provide heightmap data
+ virtual void HeightMap(const cChunkDef::HeightMap * a_HeightMap) {UNUSED(a_HeightMap); };
+
+ /// Called once to provide biome data
+ virtual void BiomeData (const cChunkDef::BiomeMap * a_BiomeMap) {UNUSED(a_BiomeMap); };
+
+ /// Called once to let know if the chunk lighting is valid. Return value is ignored
+ virtual void LightIsValid(bool a_IsLightValid) {UNUSED(a_IsLightValid); };
+
+ /// Called once to export block info
+ virtual void ChunkBuffer (const cChunkBuffer & a_Buffer) {UNUSED(a_Buffer); };
+
+ /// Called for each entity in the chunk
+ virtual void Entity(cEntity * a_Entity) {UNUSED(a_Entity); };
+
+ /// Called for each blockentity in the chunk
+ 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 cChunkBufferCollector :
+ public cChunkDataCallback
+{
+public:
+
+ cChunkBuffer m_BlockData;
+
+protected:
+
+ virtual void ChunkBuffer(const cChunkBuffer & a_BlockData) override
+ {
+ m_BlockData = a_BlockData.Copy();
+ }
+};
+
+
+/** A simple implementation of the cChunkDataCallback interface that collects all block data into a single buffer
+*/
+class cChunkDataCollector :
+public cChunkDataCallback
+{
+public:
+
+ // Must be unsigned char instead of BLOCKTYPE or NIBBLETYPE, because it houses both.
+ unsigned char m_BlockData[cChunkDef::BlockDataSize];
+
+protected:
+
+ virtual void ChunkBuffer(const cChunkBuffer & a_ChunkBuffer) override
+ {
+ a_ChunkBuffer.CopyBlocks(m_BlockData);
+ a_ChunkBuffer.CopyMeta(m_BlockData + cChunkDef::NumBlocks);
+ a_ChunkBuffer.CopyLight(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
+*/
+class cChunkDataSeparateCollector :
+public cChunkDataCallback
+{
+public:
+
+ cChunkDef::BlockTypes m_BlockTypes;
+ cChunkDef::BlockNibbles m_BlockMetas;
+ cChunkDef::BlockNibbles m_BlockLight;
+ cChunkDef::BlockNibbles m_BlockSkyLight;
+
+protected:
+
+ virtual void ChunkBuffer(const cChunkBuffer & a_ChunkBuffer) override
+ {
+ a_ChunkBuffer.CopyBlocks(m_BlockTypes);
+ a_ChunkBuffer.CopyMeta(m_BlockMetas);
+ a_ChunkBuffer.CopyLight(m_BlockLight);
+ a_ChunkBuffer.CopySkyLight(m_BlockSkyLight);
+ }
+} ;
+
diff --git a/src/ChunkDef.h b/src/ChunkDef.h
index d79f4b92b..f89e16ed1 100644
--- a/src/ChunkDef.h
+++ b/src/ChunkDef.h
@@ -328,46 +328,6 @@ private:
-class cChunkBuffer;
-
-
-/** 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.
-*/
-class cChunkDataCallback abstract
-{
-public:
-
- virtual ~cChunkDataCallback() {}
-
- /** Called before any other callbacks to inform of the current coords
- (only in processes where multiple chunks can be processed, such as cWorld::ForEachChunkInRect()).
- If false is returned, the chunk is skipped.
- */
- virtual bool Coords(int a_ChunkX, int a_ChunkZ) { UNUSED(a_ChunkX); UNUSED(a_ChunkZ); return true; };
-
- /// Called once to provide heightmap data
- virtual void HeightMap(const cChunkDef::HeightMap * a_HeightMap) {UNUSED(a_HeightMap); };
-
- /// Called once to provide biome data
- virtual void BiomeData (const cChunkDef::BiomeMap * a_BiomeMap) {UNUSED(a_BiomeMap); };
-
- /// Called once to let know if the chunk lighting is valid. Return value is ignored
- virtual void LightIsValid(bool a_IsLightValid) {UNUSED(a_IsLightValid); };
-
- /// Called once to export block info
- virtual void ChunkBuffer (const cChunkBuffer & a_Buffer) {UNUSED(a_Buffer); };
-
- /// Called for each entity in the chunk
- virtual void Entity(cEntity * a_Entity) {UNUSED(a_Entity); };
-
- /// Called for each blockentity in the chunk
- virtual void BlockEntity(cBlockEntity * a_Entity) {UNUSED(a_Entity); };
-} ;
-
-
-
/** Interface class used for comparing clients of two chunks.
diff --git a/src/ChunkMap.h b/src/ChunkMap.h
index 9d973f2a9..c3deda088 100644
--- a/src/ChunkMap.h
+++ b/src/ChunkMap.h
@@ -5,7 +5,8 @@
#pragma once
-#include "ChunkDef.h"
+
+#include "ChunkDataCallback.h"
diff --git a/src/ChunkSender.h b/src/ChunkSender.h
index 81b298a55..00565d7c3 100644
--- a/src/ChunkSender.h
+++ b/src/ChunkSender.h
@@ -27,7 +27,7 @@ Note that it may be called by world's BroadcastToChunk() if the client is still
#include "OSSupport/IsThread.h"
#include "ChunkDef.h"
-#include "ChunkBuffer.h"
+#include "ChunkDataCallback.h"
diff --git a/src/WorldStorage/NBTChunkSerializer.h b/src/WorldStorage/NBTChunkSerializer.h
index 6da2bc6dd..112afc27e 100644
--- a/src/WorldStorage/NBTChunkSerializer.h
+++ b/src/WorldStorage/NBTChunkSerializer.h
@@ -9,7 +9,7 @@
#pragma once
-#include "../ChunkBuffer.h"
+#include "ChunkDataCallback.h"
diff --git a/src/WorldStorage/WSSCompact.h b/src/WorldStorage/WSSCompact.h
index 606853a16..6c363d5ac 100644
--- a/src/WorldStorage/WSSCompact.h
+++ b/src/WorldStorage/WSSCompact.h
@@ -14,7 +14,7 @@
#include "WorldStorage.h"
#include "../Vector3.h"
#include "json/json.h"
-#include "ChunkBuffer.h"
+#include "ChunkDataCallback.h"