From cead22a206617207d8f757b57e064eea39d0b2f2 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 29 Sep 2012 13:33:45 +0000 Subject: AnvilStats: Overall statistics and mobspawner statistics. git-svn-id: http://mc-server.googlecode.com/svn/trunk@899 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- AnvilStats/Utils.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'AnvilStats/Utils.cpp') diff --git a/AnvilStats/Utils.cpp b/AnvilStats/Utils.cpp index e6fe296e0..be1f067c0 100644 --- a/AnvilStats/Utils.cpp +++ b/AnvilStats/Utils.cpp @@ -10,6 +10,47 @@ +struct +{ + eEntityType Type; + const char * String; +} g_EntityTypes[] = +{ + {entBat, "Bat"}, + {entBlaze, "Blaze"}, + {entCaveSpider, "CaveSpider"}, + {entChicken, "Chicken"}, + {entCow, "Cow"}, + {entCreeper, "Creeper"}, + {entEnderDragon, "EnderDragon"}, + {entEnderman, "Enderman"}, + {entGhast, "Ghast"}, + {entGiant, "Giant"}, + {entLavaSlime, "LavaSlime"}, + {entMushroomCow, "MushroomCow"}, + {entOzelot, "Ozelot"}, + {entPig, "Pig"}, + {entPigZombie, "PigZombie"}, + {entSheep, "Sheep"}, + {entSilverfish, "Slverfish"}, + {entSkeleton, "Skeleton"}, + {entSlime, "Slime"}, + {entSnowMan, "SnowMan"}, + {entSpider, "Spider"}, + {entSquid, "Squid"}, + {entVillager, "Villager"}, + {entVillagerGolem, "VillagerGolem"}, + {entWitch, "Witch"}, + {entWitherBoss, "WitherBoss"}, + {entWolf, "Wolf"}, + {entZombie, "Zombie"}, + {entUnknown, "Unknown"}, +} ; + + + + + const char * GetBiomeString(unsigned char a_Biome) { static const char * BiomeNames[] = // Biome names, as equivalent to their index @@ -203,6 +244,31 @@ const char * GetBlockTypeString(unsigned char a_BlockType) +eEntityType GetEntityType(const AString & a_EntityTypeString) +{ + for (int i = 0; i < ARRAYCOUNT(g_EntityTypes); i++) + { + if (a_EntityTypeString == g_EntityTypes[i].String) + { + return g_EntityTypes[i].Type; + } + } + return entUnknown; +} + + + + + +extern const char * GetEntityTypeString(eEntityType a_EntityType) +{ + return g_EntityTypes[a_EntityType].String; +} + + + + + int GetNumCores(void) { // Get number of cores by querying the system process affinity mask (Windows-specific) -- cgit v1.2.3