summaryrefslogtreecommitdiffstats
path: root/source/MobFamilyCollecter.cpp
diff options
context:
space:
mode:
authormgueydan <gueydan.mathieuÃ@gmail.com>2013-09-07 22:19:56 +0200
committermgueydan <gueydan.mathieuÃ@gmail.com>2013-09-07 22:19:56 +0200
commitd2eb58f27780a3c65fedd0d21d152ee8866ebb86 (patch)
tree05160377f78b97b4916956eebfd07f8a830a8916 /source/MobFamilyCollecter.cpp
parentAdding a getType in Monster that return an enum instead of an int or char (diff)
downloadcuberite-d2eb58f27780a3c65fedd0d21d152ee8866ebb86.tar
cuberite-d2eb58f27780a3c65fedd0d21d152ee8866ebb86.tar.gz
cuberite-d2eb58f27780a3c65fedd0d21d152ee8866ebb86.tar.bz2
cuberite-d2eb58f27780a3c65fedd0d21d152ee8866ebb86.tar.lz
cuberite-d2eb58f27780a3c65fedd0d21d152ee8866ebb86.tar.xz
cuberite-d2eb58f27780a3c65fedd0d21d152ee8866ebb86.tar.zst
cuberite-d2eb58f27780a3c65fedd0d21d152ee8866ebb86.zip
Diffstat (limited to 'source/MobFamilyCollecter.cpp')
-rw-r--r--source/MobFamilyCollecter.cpp33
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();
+}