diff options
author | nshah25 <68348722+nshah25@users.noreply.github.com> | 2021-05-03 22:07:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 22:07:09 +0200 |
commit | 8be1dd54bb17b3ba3e20960aa3c3f696d09facf7 (patch) | |
tree | 334cf9a2c9f781816f8278c933d66a71bf5c7d88 /src/Statistics.h | |
parent | Style: specify include relativity (#5217) (diff) | |
download | cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.gz cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.bz2 cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.lz cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.xz cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.zst cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.zip |
Diffstat (limited to 'src/Statistics.h')
-rw-r--r-- | src/Statistics.h | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/Statistics.h b/src/Statistics.h index 5944ba8fa..38d2f0f7e 100644 --- a/src/Statistics.h +++ b/src/Statistics.h @@ -25,35 +25,19 @@ exported from the server https://wiki.vg/Data_Generators /** Class that manages the statistics and achievements of a single player. */ -class cStatManager +struct StatisticsManager { -public: - typedef unsigned StatValue; - typedef std::unordered_map<Statistic, StatValue> CustomStore; - /** Set the value of the specified statistic. */ - void SetValue(Statistic a_Stat, StatValue a_Value); + // TODO: Block tallies, entities killed, all the others - /** Increments the specified statistic. Returns the new value. */ - StatValue AddValue(Statistic a_Stat, StatValue a_Delta = 1); + std::unordered_map<CustomStatistic, StatValue> Custom; /** Returns whether the prerequisite for awarding an achievement are satisfied. */ - bool SatisfiesPrerequisite(Statistic a_Stat); - - /** Invokes the given callbacks for each category of tracked statistics. */ - template <class CustomCallback> - void ForEachStatisticType(CustomCallback a_Custom) const - { - a_Custom(m_CustomStatistics); - } + bool SatisfiesPrerequisite(CustomStatistic a_Stat) const; private: /** Returns if a statistic is both present and has nonzero value. */ - bool IsStatisticPresent(Statistic a_Stat) const; - - // TODO: Block tallies, entities killed, all the others - - CustomStore m_CustomStatistics; + bool IsStatisticPresent(CustomStatistic a_Stat) const; }; |