diff options
author | bearbin <bearbin@gmail.com> | 2013-07-29 14:55:26 +0200 |
---|---|---|
committer | bearbin <bearbin@gmail.com> | 2013-07-29 14:55:26 +0200 |
commit | fb1044c4e55c726753d094b66756a1cb3bc60ee8 (patch) | |
tree | c61e56725da7dff0154d566722651e2c39c9d6c6 /Tools/AnvilStats/SpringStats.h | |
parent | WebAdmin: Removed the duplicate memory usage querying (diff) | |
parent | Changed everyting to Unix line endings. (diff) | |
download | cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.gz cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.bz2 cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.lz cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.xz cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.tar.zst cuberite-fb1044c4e55c726753d094b66756a1cb3bc60ee8.zip |
Diffstat (limited to '')
-rw-r--r-- | Tools/AnvilStats/SpringStats.h | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/Tools/AnvilStats/SpringStats.h b/Tools/AnvilStats/SpringStats.h index 292c5b82d..43b9f00d5 100644 --- a/Tools/AnvilStats/SpringStats.h +++ b/Tools/AnvilStats/SpringStats.h @@ -1,102 +1,102 @@ -
-// SpringStats.h
-
-// Declares the cSpringStats class representing a cCallback descendant that collects statistics on lava and water springs
-
-
-
-
-
-#pragma once
-
-#include "Callback.h"
-
-
-
-
-
-class cSpringStats :
- public cCallback
-{
-public:
- class cStats
- {
- public:
- /// Per-height, per-biome frequencies of springs
- typedef UInt64 SpringStats[256][256];
-
- SpringStats m_LavaSprings;
- SpringStats m_WaterSprings;
-
- UInt64 m_TotalChunks; ///< Total number of chunks that are fully processed through this callback(OnSectionsFinished())
-
- cStats(void);
- void Add(const cStats & a_Other);
- } ;
-
- cSpringStats(void);
-
- const cStats & GetStats(void) const { return m_Stats; }
-
-protected:
-
- BLOCKTYPE m_BlockTypes[16 * 16 * 256];
- NIBBLETYPE m_BlockMetas[16 * 16 * 256 / 2];
- char m_Biomes[16 * 16];
- bool m_AreBiomesValid;
-
- cStats m_Stats;
-
- // 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 { return false; }
- virtual bool OnDecompressedData(const char * a_DecompressedNBT, int a_DataSize) override { return false; }
- virtual bool OnRealCoords(int a_ChunkX, int a_ChunkZ) override { return false; }
- virtual bool OnLastUpdate(Int64 a_LastUpdate) override { return false; }
- virtual bool OnTerrainPopulated(bool a_Populated) override { return !a_Populated; } // If not populated, we don't want it!
- virtual bool OnBiomes(const unsigned char * a_BiomeData) override;
- virtual bool OnHeightMap(const int * a_HeightMap) override { return false; }
- virtual bool OnSection(
- unsigned char a_Y,
- const BLOCKTYPE * a_BlockTypes,
- const NIBBLETYPE * a_BlockAdditional,
- const NIBBLETYPE * a_BlockMeta,
- const NIBBLETYPE * a_BlockLight,
- const NIBBLETYPE * a_BlockSkyLight
- ) override;
- virtual bool OnSectionsFinished(void) override;
-
- /// Tests the specified block, if it appears to be a spring, it is added to a_Stats
- void TestSpring(int a_RelX, int a_RelY, int a_RelZ, cStats::SpringStats & a_Stats);
-} ;
-
-
-
-
-
-class cSpringStatsFactory :
- public cCallbackFactory
-{
-public:
- virtual ~cSpringStatsFactory();
-
- virtual cCallback * CreateNewCallback(void) override
- {
- return new cSpringStats;
- }
-
- cSpringStats::cStats m_CombinedStats;
-
- void JoinResults(void);
-
- /// Saves total per-height data (summed through biomes) for both spring types to the file
- void SaveTotals(const AString & a_FileName);
-
- /// Saves complete per-height, per-biome statistics for the springs to the file
- void SaveStatistics(const cSpringStats::cStats::SpringStats & a_Stats, const AString & a_FileName);
-} ;
-
-
-
-
+ +// SpringStats.h + +// Declares the cSpringStats class representing a cCallback descendant that collects statistics on lava and water springs + + + + + +#pragma once + +#include "Callback.h" + + + + + +class cSpringStats : + public cCallback +{ +public: + class cStats + { + public: + /// Per-height, per-biome frequencies of springs + typedef UInt64 SpringStats[256][256]; + + SpringStats m_LavaSprings; + SpringStats m_WaterSprings; + + UInt64 m_TotalChunks; ///< Total number of chunks that are fully processed through this callback(OnSectionsFinished()) + + cStats(void); + void Add(const cStats & a_Other); + } ; + + cSpringStats(void); + + const cStats & GetStats(void) const { return m_Stats; } + +protected: + + BLOCKTYPE m_BlockTypes[16 * 16 * 256]; + NIBBLETYPE m_BlockMetas[16 * 16 * 256 / 2]; + char m_Biomes[16 * 16]; + bool m_AreBiomesValid; + + cStats m_Stats; + + // 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 { return false; } + virtual bool OnDecompressedData(const char * a_DecompressedNBT, int a_DataSize) override { return false; } + virtual bool OnRealCoords(int a_ChunkX, int a_ChunkZ) override { return false; } + virtual bool OnLastUpdate(Int64 a_LastUpdate) override { return false; } + virtual bool OnTerrainPopulated(bool a_Populated) override { return !a_Populated; } // If not populated, we don't want it! + virtual bool OnBiomes(const unsigned char * a_BiomeData) override; + virtual bool OnHeightMap(const int * a_HeightMap) override { return false; } + virtual bool OnSection( + unsigned char a_Y, + const BLOCKTYPE * a_BlockTypes, + const NIBBLETYPE * a_BlockAdditional, + const NIBBLETYPE * a_BlockMeta, + const NIBBLETYPE * a_BlockLight, + const NIBBLETYPE * a_BlockSkyLight + ) override; + virtual bool OnSectionsFinished(void) override; + + /// Tests the specified block, if it appears to be a spring, it is added to a_Stats + void TestSpring(int a_RelX, int a_RelY, int a_RelZ, cStats::SpringStats & a_Stats); +} ; + + + + + +class cSpringStatsFactory : + public cCallbackFactory +{ +public: + virtual ~cSpringStatsFactory(); + + virtual cCallback * CreateNewCallback(void) override + { + return new cSpringStats; + } + + cSpringStats::cStats m_CombinedStats; + + void JoinResults(void); + + /// Saves total per-height data (summed through biomes) for both spring types to the file + void SaveTotals(const AString & a_FileName); + + /// Saves complete per-height, per-biome statistics for the springs to the file + void SaveStatistics(const cSpringStats::cStats::SpringStats & a_Stats, const AString & a_FileName); +} ; + + + + |