summaryrefslogtreecommitdiffstats
path: root/AnvilStats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-04 14:07:06 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-04 14:07:06 +0200
commit1accc5aee8622059d9cece806d291c0d05fc3932 (patch)
tree1b5690b51ae71c8cc8fc15f4805f9536c9cabcc8 /AnvilStats
parentCryptoPP: Removed an unused file that broke compilation on some *nixes (diff)
downloadcuberite-1accc5aee8622059d9cece806d291c0d05fc3932.tar
cuberite-1accc5aee8622059d9cece806d291c0d05fc3932.tar.gz
cuberite-1accc5aee8622059d9cece806d291c0d05fc3932.tar.bz2
cuberite-1accc5aee8622059d9cece806d291c0d05fc3932.tar.lz
cuberite-1accc5aee8622059d9cece806d291c0d05fc3932.tar.xz
cuberite-1accc5aee8622059d9cece806d291c0d05fc3932.tar.zst
cuberite-1accc5aee8622059d9cece806d291c0d05fc3932.zip
Diffstat (limited to 'AnvilStats')
-rw-r--r--AnvilStats/AnvilStats.cpp2
-rw-r--r--AnvilStats/Statistics.cpp42
-rw-r--r--AnvilStats/Statistics.h3
3 files changed, 45 insertions, 2 deletions
diff --git a/AnvilStats/AnvilStats.cpp b/AnvilStats/AnvilStats.cpp
index 7a7c34f98..c0b456b96 100644
--- a/AnvilStats/AnvilStats.cpp
+++ b/AnvilStats/AnvilStats.cpp
@@ -48,6 +48,8 @@ int main(int argc, char * argv[])
cProcessor Processor;
Processor.ProcessWorld(WorldFolder, *Factory);
+ LOG("Processing finished");
+
delete Factory;
LOG("Done");
diff --git a/AnvilStats/Statistics.cpp b/AnvilStats/Statistics.cpp
index f786cac79..fca01ea85 100644
--- a/AnvilStats/Statistics.cpp
+++ b/AnvilStats/Statistics.cpp
@@ -20,7 +20,11 @@ cStatistics::cStats::cStats(void) :
m_BlockNumChunks(0),
m_NumEntities(0),
m_NumTileEntities(0),
- m_NumTileTicks(0)
+ m_NumTileTicks(0),
+ m_MinChunkX(0x7fffffff),
+ m_MaxChunkX(0x80000000),
+ m_MinChunkZ(0x7fffffff),
+ m_MaxChunkZ(0x80000000)
{
memset(m_BiomeCounts, 0, sizeof(m_BiomeCounts));
memset(m_BlockCounts, 0, sizeof(m_BlockCounts));
@@ -54,6 +58,32 @@ void cStatistics::cStats::Add(const cStatistics::cStats & a_Stats)
m_NumEntities += a_Stats.m_NumEntities;
m_NumTileEntities += a_Stats.m_NumTileEntities;
m_NumTileTicks += a_Stats.m_NumTileTicks;
+ UpdateCoordsRange(a_Stats.m_MinChunkX, a_Stats.m_MinChunkZ);
+ UpdateCoordsRange(a_Stats.m_MinChunkX, a_Stats.m_MinChunkZ);
+}
+
+
+
+
+
+void cStatistics::cStats::UpdateCoordsRange(int a_ChunkX, int a_ChunkZ)
+{
+ if (a_ChunkX < m_MinChunkX)
+ {
+ m_MinChunkX = a_ChunkX;
+ }
+ if (a_ChunkX > m_MaxChunkX)
+ {
+ m_MaxChunkX = a_ChunkX;
+ }
+ if (a_ChunkZ < m_MinChunkZ)
+ {
+ m_MinChunkZ = a_ChunkZ;
+ }
+ if (a_ChunkZ > m_MaxChunkZ)
+ {
+ m_MaxChunkZ = a_ChunkZ;
+ }
}
@@ -74,6 +104,7 @@ cStatistics::cStatistics(void)
bool cStatistics::OnNewChunk(int a_ChunkX, int a_ChunkZ)
{
m_Stats.m_TotalChunks++;
+ m_Stats.UpdateCoordsRange(a_ChunkX, a_ChunkZ);
m_IsBiomesValid = false;
m_IsFirstSectionInChunk = true;
return false;
@@ -459,6 +490,9 @@ void cStatisticsFactory::SaveStatistics(void)
f.Printf("Total entities counted: %d\n", m_CombinedStats.m_NumEntities);
f.Printf("Total tile entities counted: %d\n", m_CombinedStats.m_NumTileEntities);
f.Printf("Total tile ticks counted: %d\n", m_CombinedStats.m_NumTileTicks);
+ f.Printf("Chunk coord ranges:\n");
+ f.Printf("\tX: %d .. %d\n", m_CombinedStats.m_MinChunkX, m_CombinedStats.m_MaxChunkX);
+ f.Printf("\tZ: %d .. %d\n", m_CombinedStats.m_MinChunkZ, m_CombinedStats.m_MaxChunkZ);
}
@@ -479,4 +513,8 @@ void cStatisticsFactory::SaveSpawners(void)
{
f.Printf("%s\t%d\t%0.4f\n", GetEntityTypeString((eEntityType)i), m_CombinedStats.m_SpawnerEntity[i], (double)(m_CombinedStats.m_SpawnerEntity[i]) / m_CombinedStats.m_BlockNumChunks);
}
-} \ No newline at end of file
+}
+
+
+
+
diff --git a/AnvilStats/Statistics.h b/AnvilStats/Statistics.h
index 8be58bf8e..814380b6c 100644
--- a/AnvilStats/Statistics.h
+++ b/AnvilStats/Statistics.h
@@ -31,11 +31,14 @@ public:
int m_NumEntities;
int m_NumTileEntities;
int m_NumTileTicks;
+ int m_MinChunkX, m_MaxChunkX; // X coords range
+ int m_MinChunkZ, m_MaxChunkZ; // Z coords range
int m_SpawnerEntity[entMax + 1];
cStats(void);
void Add(const cStats & a_Stats);
+ void UpdateCoordsRange(int a_ChunkX, int a_ChunkZ);
} ;
cStatistics(void);