summaryrefslogtreecommitdiffstats
path: root/AnvilStats/ChunkExtract.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-02-25 20:06:37 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-02-25 20:06:37 +0100
commit24d3d5dac40562f22a43eb9934c90165ace92a35 (patch)
tree43f641312f850d0123f0d86a6a685f4e5ac6ffc9 /AnvilStats/ChunkExtract.h
parentMoved the Speed member into cEntity class instead of its descendants. (diff)
downloadcuberite-24d3d5dac40562f22a43eb9934c90165ace92a35.tar
cuberite-24d3d5dac40562f22a43eb9934c90165ace92a35.tar.gz
cuberite-24d3d5dac40562f22a43eb9934c90165ace92a35.tar.bz2
cuberite-24d3d5dac40562f22a43eb9934c90165ace92a35.tar.lz
cuberite-24d3d5dac40562f22a43eb9934c90165ace92a35.tar.xz
cuberite-24d3d5dac40562f22a43eb9934c90165ace92a35.tar.zst
cuberite-24d3d5dac40562f22a43eb9934c90165ace92a35.zip
Diffstat (limited to '')
-rw-r--r--AnvilStats/ChunkExtract.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/AnvilStats/ChunkExtract.h b/AnvilStats/ChunkExtract.h
new file mode 100644
index 000000000..5e0ed8a9a
--- /dev/null
+++ b/AnvilStats/ChunkExtract.h
@@ -0,0 +1,66 @@
+
+// ChunkExtract.h
+
+// Declares the cChunkExtract class representing a cCallback descendant that extracts raw chunk data into separate .chunk files
+
+
+
+
+
+#pragma once
+
+#include "Callback.h"
+
+
+
+
+
+class cChunkExtract :
+ public cCallback
+{
+public:
+ cChunkExtract(const AString & iWorldFolder);
+
+protected:
+ AString mWorldFolder;
+ cFile mAnvilFile;
+ int mCurAnvilX; // X-coord of mAnvilFile, in Anvil-coords (1 Anvil-coord = 32 chunks)
+ int mCurAnvilZ; // Z-coord of mAnvilFile, -"-
+ int mCurChunkX; // X-coord of the chunk being processed
+ int mCurChunkZ; // Z-coord of the chunk being processed
+
+ /// Opens new anvil file into mAnvilFile, sets mCurAnvilX and mCurAnvilZ
+ void OpenAnvilFile(int a_AnvilX, int a_AnvilZ);
+
+ // cCallback overrides:
+ virtual bool OnNewChunk(int a_ChunkX, int a_ChunkZ) override;
+ virtual bool OnHeader(int a_FileOffset, unsigned char a_NumSectors, int a_Timestamp) override { return false; }
+ virtual bool OnCompressedDataSizePos(int a_CompressedDataSize, int a_DataOffset, char a_CompressionMethod) override;
+ virtual bool OnDecompressedData(const char * a_DecompressedNBT, int a_DataSize) override;
+} ;
+
+
+
+
+
+class cChunkExtractFactory :
+ public cCallbackFactory
+{
+public:
+ cChunkExtractFactory(const AString & iWorldFolder) :
+ mWorldFolder(iWorldFolder)
+ {
+ }
+
+ virtual cCallback * CreateNewCallback(void) override
+ {
+ return new cChunkExtract(mWorldFolder);
+ }
+
+protected:
+ AString mWorldFolder;
+} ;
+
+
+
+