summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-08-27 11:24:56 +0200
committerMattes D <github@xoft.cz>2014-08-27 11:24:56 +0200
commitaf47b5ece2bfe274e305f0602dff8e7a74ae0360 (patch)
treedb6927384df5cd2282ba73c05ccd91c3e94854bd
parentAnvilStats: Ignoring output XLS files. (diff)
downloadcuberite-af47b5ece2bfe274e305f0602dff8e7a74ae0360.tar
cuberite-af47b5ece2bfe274e305f0602dff8e7a74ae0360.tar.gz
cuberite-af47b5ece2bfe274e305f0602dff8e7a74ae0360.tar.bz2
cuberite-af47b5ece2bfe274e305f0602dff8e7a74ae0360.tar.lz
cuberite-af47b5ece2bfe274e305f0602dff8e7a74ae0360.tar.xz
cuberite-af47b5ece2bfe274e305f0602dff8e7a74ae0360.tar.zst
cuberite-af47b5ece2bfe274e305f0602dff8e7a74ae0360.zip
Diffstat (limited to '')
-rw-r--r--Tools/AnvilStats/Statistics.cpp48
-rw-r--r--Tools/AnvilStats/Statistics.h3
2 files changed, 47 insertions, 4 deletions
diff --git a/Tools/AnvilStats/Statistics.cpp b/Tools/AnvilStats/Statistics.cpp
index 11b9f09c5..c8a98b488 100644
--- a/Tools/AnvilStats/Statistics.cpp
+++ b/Tools/AnvilStats/Statistics.cpp
@@ -342,6 +342,8 @@ cStatisticsFactory::~cStatisticsFactory()
SaveBiomeBlockTypes();
LOG(" Spawners.xls");
SaveSpawners();
+ LOG(" PerHeightSpawners.xls");
+ SavePerHeightSpawners();
}
@@ -429,7 +431,7 @@ void cStatisticsFactory::SavePerHeightBlockTypes(void)
}
// Write header:
- f.Printf("Blocks 0 - 127:\nHeight\t");
+ f.Printf("Blocks 0 - 127:\nHeight");
for (int i = 0; i < 128; i++)
{
f.Printf("\t%s(%d)", GetBlockTypeString(i), i);
@@ -442,14 +444,14 @@ void cStatisticsFactory::SavePerHeightBlockTypes(void)
f.Printf("%d", y);
for (int BlockType = 0; BlockType < 128; BlockType++)
{
- f.Printf("\t%d", m_CombinedStats.m_PerHeightBlockCounts[y][BlockType]);
+ f.Printf("\t%llu", m_CombinedStats.m_PerHeightBlockCounts[y][BlockType]);
} // for BlockType
f.Printf("\n");
} // for y - height (0 - 127)
f.Printf("\n");
// Write second header:
- f.Printf("Blocks 128 - 255:\nHeight\t");
+ f.Printf("Blocks 128 - 255:\nHeight");
for (int i = 128; i < 256; i++)
{
f.Printf("\t%s(%d)", GetBlockTypeString(i), i);
@@ -462,7 +464,7 @@ void cStatisticsFactory::SavePerHeightBlockTypes(void)
f.Printf("%d", y);
for (int BlockType = 128; BlockType < 256; BlockType++)
{
- f.Printf("\t%d", m_CombinedStats.m_PerHeightBlockCounts[y][BlockType]);
+ f.Printf("\t%llu", m_CombinedStats.m_PerHeightBlockCounts[y][BlockType]);
} // for BlockType
f.Printf("\n");
} // for y - height (0 - 127)
@@ -598,3 +600,41 @@ void cStatisticsFactory::SaveSpawners(void)
+
+void cStatisticsFactory::SavePerHeightSpawners(void)
+{
+ cFile f;
+ if (!f.Open("PerHeightSpawners.xls", cFile::fmWrite))
+ {
+ LOG("Cannot write to file PerHeightSpawners.xls. Statistics not written.");
+ return;
+ }
+
+ // Write header:
+ f.Printf("Height\tTotal");
+ for (int i = 0; i < entMax; i++)
+ {
+ f.Printf("\t%s", GetEntityTypeString((eEntityType)i));
+ }
+ f.Printf("\n");
+
+ // Write individual lines:
+ for (int y = 0; y < 256; y++)
+ {
+ UInt64 Total = 0;
+ for (int i = 0; i < entMax; i++)
+ {
+ Total += m_CombinedStats.m_PerHeightSpawners[y][i];
+ }
+ f.Printf("%d\t%llu", y, Total);
+ for (int i = 0; i < entMax; i++)
+ {
+ f.Printf("\t%llu", m_CombinedStats.m_PerHeightSpawners[y][i]);
+ }
+ f.Printf("\n");
+ }
+}
+
+
+
+
diff --git a/Tools/AnvilStats/Statistics.h b/Tools/AnvilStats/Statistics.h
index f6165edd9..1b012e283 100644
--- a/Tools/AnvilStats/Statistics.h
+++ b/Tools/AnvilStats/Statistics.h
@@ -76,6 +76,8 @@ protected:
virtual bool OnEmptySection(unsigned char a_Y) override;
+ virtual bool OnSectionsFinished(void) override { return false; } // continue processing
+
virtual bool OnEntity(
const AString & a_EntityType,
double a_PosX, double a_PosY, double a_PosZ,
@@ -134,6 +136,7 @@ protected:
void SaveBiomeBlockTypes(void);
void SaveStatistics(void);
void SaveSpawners(void);
+ void SavePerHeightSpawners(void);
} ;