MCPcopy Create free account
hub / github.com/cuberite/cuberite / SaveBiomes

Method SaveBiomes

Tools/AnvilStats/Statistics.cpp:341–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339
340
341void cStatisticsFactory::SaveBiomes(void)
342{
343 cFile f;
344 if (!f.Open("Biomes.xls", cFile::fmWrite))
345 {
346 LOG("Cannot write to file Biomes.xls. Statistics not written.");
347 return;
348 }
349 double TotalColumns = (double)(m_CombinedStats.m_BiomeNumChunks) * 16 * 16 / 100; // Total number of columns processed; convert into percent
350 if (TotalColumns < 1)
351 {
352 // Avoid division by zero
353 TotalColumns = 1;
354 }
355 for (int i = 0; i <= 255; i++)
356 {
357 AString Line;
358 Printf(Line, "%s\t%d\t%llu\t%.05f\n", GetBiomeString(i), i, m_CombinedStats.m_BiomeCounts[i], ((double)(m_CombinedStats.m_BiomeCounts[i])) / TotalColumns);
359 f.Write(Line.c_str(), Line.length());
360 }
361}
362
363
364

Callers

nothing calls this directly

Calls 6

LOGFunction · 0.85
PrintfFunction · 0.85
GetBiomeStringFunction · 0.85
c_strMethod · 0.80
OpenMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected