diff options
author | Samuel Barney <samjbarney@gmail.com> | 2013-10-14 18:03:47 +0200 |
---|---|---|
committer | Samuel Barney <samjbarney@gmail.com> | 2013-10-14 18:03:47 +0200 |
commit | 318d5522486f3aedc2e808f955eff97957bd968e (patch) | |
tree | 7d9a3c5ad98585fb298691110dd4296de86a9317 /source/MobFamilyCollecter.cpp | |
parent | Merge branch 'master' of https://github.com/mc-server/MCServer (diff) | |
parent | Merge branch 'master' into MobSpawning (diff) | |
download | cuberite-318d5522486f3aedc2e808f955eff97957bd968e.tar cuberite-318d5522486f3aedc2e808f955eff97957bd968e.tar.gz cuberite-318d5522486f3aedc2e808f955eff97957bd968e.tar.bz2 cuberite-318d5522486f3aedc2e808f955eff97957bd968e.tar.lz cuberite-318d5522486f3aedc2e808f955eff97957bd968e.tar.xz cuberite-318d5522486f3aedc2e808f955eff97957bd968e.tar.zst cuberite-318d5522486f3aedc2e808f955eff97957bd968e.zip |
Diffstat (limited to 'source/MobFamilyCollecter.cpp')
-rw-r--r-- | source/MobFamilyCollecter.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/source/MobFamilyCollecter.cpp b/source/MobFamilyCollecter.cpp new file mode 100644 index 000000000..2aa46599a --- /dev/null +++ b/source/MobFamilyCollecter.cpp @@ -0,0 +1,33 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "MobFamilyCollecter.h" +#include "Mobs/Monster.h" + + + +cMobFamilyCollecter::tMobFamilyList cMobFamilyCollecter::initMobFamilyBeforeCx11() +{ + std::set<cMonster::eFamily> toReturn; + toReturn.insert(cMonster::mfHostile); + toReturn.insert(cMonster::mfPassive); + toReturn.insert(cMonster::mfAmbient); + toReturn.insert(cMonster::mfWater); + return toReturn; +} +cMobFamilyCollecter::tMobFamilyList& cMobFamilyCollecter::m_AllFamilies() +{ + static tMobFamilyList* AllFamilies = new tMobFamilyList(initMobFamilyBeforeCx11()); + return *AllFamilies; +} + +void cMobFamilyCollecter::CollectMob(cMonster& a_Monster) +{ + cMonster::eFamily MobFamily = a_Monster.GetMobFamily(); + m_Mobs[MobFamily].insert(&a_Monster); +} + +int cMobFamilyCollecter::getNumberOfCollectedMobs(cMonster::eFamily a_Family) +{ + return m_Mobs[a_Family].size(); +} |