summaryrefslogtreecommitdiffstats
path: root/src/Statistics.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-18 23:10:23 +0200
committermadmaxoft <github@xoft.cz>2014-05-18 23:10:23 +0200
commite69a11012fb7543d47230663a01af2a7ec20960c (patch)
tree2c4a5b6759f76059736bdf5b30ea17f2a6ee8570 /src/Statistics.cpp
parentUpdated SandVillage prefabs to latest Gallery content. (diff)
parentThere's no "round" function in MSVC2008. (diff)
downloadcuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.gz
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.bz2
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.lz
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.xz
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.zst
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.zip
Diffstat (limited to 'src/Statistics.cpp')
-rw-r--r--src/Statistics.cpp127
1 files changed, 92 insertions, 35 deletions
diff --git a/src/Statistics.cpp b/src/Statistics.cpp
index 2c980d98e..5950eb96c 100644
--- a/src/Statistics.cpp
+++ b/src/Statistics.cpp
@@ -13,39 +13,39 @@ cStatInfo cStatInfo::ms_Info[statCount] = {
// http://minecraft.gamepedia.com/Achievements
/* Type | Name | Prerequisite */
- cStatInfo(achOpenInv, "openInventory"),
- cStatInfo(achMineWood, "mineWood", achOpenInv),
- cStatInfo(achCraftWorkbench, "buildWorkBench", achMineWood),
- cStatInfo(achCraftPickaxe, "buildPickaxe", achCraftWorkbench),
- cStatInfo(achCraftFurnace, "buildFurnace", achCraftPickaxe),
- cStatInfo(achAcquireIron, "acquireIron", achCraftFurnace),
- cStatInfo(achCraftHoe, "buildHoe", achCraftWorkbench),
- cStatInfo(achMakeBread, "makeBread", achCraftHoe),
- cStatInfo(achBakeCake, "bakeCake", achCraftHoe),
- cStatInfo(achCraftBetterPick, "buildBetterPickaxe", achCraftPickaxe),
- cStatInfo(achCookFish, "cookFish", achAcquireIron),
- cStatInfo(achOnARail, "onARail", achAcquireIron),
- cStatInfo(achCraftSword, "buildSword", achCraftWorkbench),
- cStatInfo(achKillMonster, "killEnemy", achCraftSword),
- cStatInfo(achKillCow, "killCow", achCraftSword),
- cStatInfo(achFlyPig, "flyPig", achKillCow),
- cStatInfo(achSnipeSkeleton, "snipeSkeleton", achKillMonster),
- cStatInfo(achDiamonds, "diamonds", achAcquireIron),
- cStatInfo(achEnterPortal, "portal", achDiamonds),
- cStatInfo(achReturnToSender, "ghast", achEnterPortal),
- cStatInfo(achBlazeRod, "blazeRod", achEnterPortal),
- cStatInfo(achBrewPotion, "potion", achBlazeRod),
- cStatInfo(achEnterTheEnd, "theEnd", achBlazeRod),
- cStatInfo(achDefeatDragon, "theEnd2", achEnterTheEnd),
- cStatInfo(achCraftEnchantTable, "enchantments", achDiamonds),
- cStatInfo(achOverkill, "overkill", achCraftEnchantTable),
- cStatInfo(achBookshelf, "bookcase", achCraftEnchantTable),
- cStatInfo(achExploreAllBiomes, "exploreAllBiomes", achEnterTheEnd),
- cStatInfo(achSpawnWither, "spawnWither", achDefeatDragon),
- cStatInfo(achKillWither, "killWither", achSpawnWither),
- cStatInfo(achFullBeacon, "fullBeacon", achKillWither),
- cStatInfo(achBreedCow, "breedCow", achKillCow),
- cStatInfo(achThrowDiamonds, "diamondsToYou", achDiamonds),
+ cStatInfo(achOpenInv, "achievement.openInventory"),
+ cStatInfo(achMineWood, "achievement.mineWood", achOpenInv),
+ cStatInfo(achCraftWorkbench, "achievement.buildWorkBench", achMineWood),
+ cStatInfo(achCraftPickaxe, "achievement.buildPickaxe", achCraftWorkbench),
+ cStatInfo(achCraftFurnace, "achievement.buildFurnace", achCraftPickaxe),
+ cStatInfo(achAcquireIron, "achievement.acquireIron", achCraftFurnace),
+ cStatInfo(achCraftHoe, "achievement.buildHoe", achCraftWorkbench),
+ cStatInfo(achMakeBread, "achievement.makeBread", achCraftHoe),
+ cStatInfo(achBakeCake, "achievement.bakeCake", achCraftHoe),
+ cStatInfo(achCraftBetterPick, "achievement.buildBetterPickaxe", achCraftPickaxe),
+ cStatInfo(achCookFish, "achievement.cookFish", achAcquireIron),
+ cStatInfo(achOnARail, "achievement.onARail", achAcquireIron),
+ cStatInfo(achCraftSword, "achievement.buildSword", achCraftWorkbench),
+ cStatInfo(achKillMonster, "achievement.killEnemy", achCraftSword),
+ cStatInfo(achKillCow, "achievement.killCow", achCraftSword),
+ cStatInfo(achFlyPig, "achievement.flyPig", achKillCow),
+ cStatInfo(achSnipeSkeleton, "achievement.snipeSkeleton", achKillMonster),
+ cStatInfo(achDiamonds, "achievement.diamonds", achAcquireIron),
+ cStatInfo(achEnterPortal, "achievement.portal", achDiamonds),
+ cStatInfo(achReturnToSender, "achievement.ghast", achEnterPortal),
+ cStatInfo(achBlazeRod, "achievement.blazeRod", achEnterPortal),
+ cStatInfo(achBrewPotion, "achievement.potion", achBlazeRod),
+ cStatInfo(achEnterTheEnd, "achievement.theEnd", achBlazeRod),
+ cStatInfo(achDefeatDragon, "achievement.theEnd2", achEnterTheEnd),
+ cStatInfo(achCraftEnchantTable, "achievement.enchantments", achDiamonds),
+ cStatInfo(achOverkill, "achievement.overkill", achCraftEnchantTable),
+ cStatInfo(achBookshelf, "achievement.bookcase", achCraftEnchantTable),
+ cStatInfo(achExploreAllBiomes, "achievement.exploreAllBiomes", achEnterTheEnd),
+ cStatInfo(achSpawnWither, "achievement.spawnWither", achDefeatDragon),
+ cStatInfo(achKillWither, "achievement.killWither", achSpawnWither),
+ cStatInfo(achFullBeacon, "achievement.fullBeacon", achKillWither),
+ cStatInfo(achBreedCow, "achievement.breedCow", achKillCow),
+ cStatInfo(achThrowDiamonds, "achievement.diamondsToYou", achDiamonds),
// http://minecraft.gamepedia.com/Statistics
@@ -57,13 +57,14 @@ cStatInfo cStatInfo::ms_Info[statCount] = {
cStatInfo(statDistFallen, "stat.fallOneCm"),
cStatInfo(statDistClimbed, "stat.climbOneCm"),
cStatInfo(statDistFlown, "stat.flyOneCm"),
+ cStatInfo(statDistDove, "stat.diveOneCm"),
cStatInfo(statDistMinecart, "stat.minecartOneCm"),
cStatInfo(statDistBoat, "stat.boatOneCm"),
cStatInfo(statDistPig, "stat.pigOneCm"),
cStatInfo(statDistHorse, "stat.horseOneCm"),
cStatInfo(statJumps, "stat.jump"),
cStatInfo(statItemsDropped, "stat.drop"),
- cStatInfo(statDamageDealt, "stat.damageDealth"),
+ cStatInfo(statDamageDealt, "stat.damageDealt"),
cStatInfo(statDamageTaken, "stat.damageTaken"),
cStatInfo(statDeaths, "stat.deaths"),
cStatInfo(statMobKills, "stat.mobKills"),
@@ -113,7 +114,7 @@ eStatistic cStatInfo::GetType(const AString & a_Name)
{
for (unsigned int i = 0; i < ARRAYCOUNT(ms_Info); ++i)
{
- if (NoCaseCompare(ms_Info[i].m_Name, a_Name))
+ if (NoCaseCompare(ms_Info[i].m_Name, a_Name) == 0)
{
return ms_Info[i].m_Type;
}
@@ -137,3 +138,59 @@ eStatistic cStatInfo::GetPrerequisite(const eStatistic a_Type)
+cStatManager::cStatManager()
+{
+ Reset();
+}
+
+
+
+
+
+StatValue cStatManager::GetValue(const eStatistic a_Stat) const
+{
+ ASSERT((a_Stat > statInvalid) && (a_Stat < statCount));
+
+ return m_MainStats[a_Stat];
+}
+
+
+
+
+
+void cStatManager::SetValue(const eStatistic a_Stat, const StatValue a_Value)
+{
+ ASSERT((a_Stat > statInvalid) && (a_Stat < statCount));
+
+ m_MainStats[a_Stat] = a_Value;
+}
+
+
+
+
+
+StatValue cStatManager::AddValue(const eStatistic a_Stat, const StatValue a_Delta)
+{
+ ASSERT((a_Stat > statInvalid) && (a_Stat < statCount));
+
+ m_MainStats[a_Stat] += a_Delta;
+
+ return m_MainStats[a_Stat];
+}
+
+
+
+
+
+void cStatManager::Reset(void)
+{
+ for (unsigned int i = 0; i < (unsigned int)statCount; ++i)
+ {
+ m_MainStats[i] = 0;
+ }
+}
+
+
+
+
+