summaryrefslogtreecommitdiffstats
path: root/Tools/AnvilStats/Statistics.cpp
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 /Tools/AnvilStats/Statistics.cpp
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 'Tools/AnvilStats/Statistics.cpp')
-rw-r--r--Tools/AnvilStats/Statistics.cpp48
1 files changed, 44 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");
+ }
+}
+
+
+
+