blob: 7bc5ae41376c12e4ac2a596333c540e6ed4a0c3b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Statistics.cpp
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Statistics.h"
void cStatManager::SetValue(const Statistic a_Stat, const StatValue a_Value)
{
m_CustomStatistics[a_Stat] = a_Value;
}
cStatManager::StatValue cStatManager::AddValue(const Statistic a_Stat, const StatValue a_Delta)
{
return m_CustomStatistics[a_Stat] += a_Delta;
}
bool cStatManager::SatisfiesPrerequisite(const Statistic a_Stat)
{
switch (a_Stat)
{
case Statistic::AchMineWood: return IsStatisticPresent(Statistic::AchOpenInventory);
case Statistic::AchBuildWorkBench: return IsStatisticPresent(Statistic::AchMineWood);
case Statistic::AchBuildHoe: return IsStatisticPresent(Statistic::AchBuildWorkBench);
case Statistic::AchBakeCake: return IsStatisticPresent(Statistic::AchBuildHoe);
case Statistic::AchMakeBread: return IsStatisticPresent(Statistic::AchBuildHoe);
case Statistic::AchBuildSword: return IsStatisticPresent(Statistic::AchBuildWorkBench);
case Statistic::AchKillCow: return IsStatisticPresent(Statistic::AchBuildSword);
case Statistic::AchFlyPig: return IsStatisticPresent(Statistic::AchKillCow);
case Statistic::AchBreedCow: return IsStatisticPresent(Statistic::AchKillCow);
case Statistic::AchKillEnemy: return IsStatisticPresent(Statistic::AchBuildSword);
case Statistic::AchSnipeSkeleton: return IsStatisticPresent(Statistic::AchKillEnemy);
case Statistic::AchBuildPickaxe: return IsStatisticPresent(Statistic::AchBuildWorkBench);
case Statistic::AchBuildBetterPickaxe: return IsStatisticPresent(Statistic::AchBuildPickaxe);
case Statistic::AchBuildFurnace: return IsStatisticPresent(Statistic::AchBuildWorkBench);
case Statistic::AchCookFish: return IsStatisticPresent(Statistic::AchBuildFurnace);
case Statistic::AchAcquireIron: return IsStatisticPresent(Statistic::AchBuildFurnace);
case Statistic::AchOnARail: return IsStatisticPresent(Statistic::AchAcquireIron);
case Statistic::AchDiamonds: return IsStatisticPresent(Statistic::AchAcquireIron);
case Statistic::AchPortal: return IsStatisticPresent(Statistic::AchDiamonds);
case Statistic::AchGhast: return IsStatisticPresent(Statistic::AchPortal);
case Statistic::AchBlazeRod: return IsStatisticPresent(Statistic::AchPortal);
case Statistic::AchPotion: return IsStatisticPresent(Statistic::AchBlazeRod);
case Statistic::AchTheEnd: return IsStatisticPresent(Statistic::AchBlazeRod);
case Statistic::AchTheEnd2: return IsStatisticPresent(Statistic::AchTheEnd);
case Statistic::AchEnchantments: return IsStatisticPresent(Statistic::AchDiamonds);
case Statistic::AchOverkill: return IsStatisticPresent(Statistic::AchEnchantments);
case Statistic::AchBookcase: return IsStatisticPresent(Statistic::AchEnchantments);
case Statistic::AchExploreAllBiomes: return IsStatisticPresent(Statistic::AchTheEnd);
case Statistic::AchSpawnWither: return IsStatisticPresent(Statistic::AchTheEnd2);
case Statistic::AchKillWither: return IsStatisticPresent(Statistic::AchSpawnWither);
case Statistic::AchFullBeacon: return IsStatisticPresent(Statistic::AchKillWither);
case Statistic::AchDiamondsToYou: return IsStatisticPresent(Statistic::AchDiamonds);
default: return true;
}
}
bool cStatManager::IsStatisticPresent(const Statistic a_Stat) const
{
const auto Result = m_CustomStatistics.find(a_Stat);
if (Result != m_CustomStatistics.end())
{
return Result->second > 0;
}
return false;
}
|