summaryrefslogtreecommitdiffstats
path: root/source/MobFamilyCollecter.h
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2013-10-14 18:03:47 +0200
committerSamuel Barney <samjbarney@gmail.com>2013-10-14 18:03:47 +0200
commit318d5522486f3aedc2e808f955eff97957bd968e (patch)
tree7d9a3c5ad98585fb298691110dd4296de86a9317 /source/MobFamilyCollecter.h
parentMerge branch 'master' of https://github.com/mc-server/MCServer (diff)
parentMerge branch 'master' into MobSpawning (diff)
downloadcuberite-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 '')
-rw-r--r--source/MobFamilyCollecter.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/source/MobFamilyCollecter.h b/source/MobFamilyCollecter.h
new file mode 100644
index 000000000..659d2b687
--- /dev/null
+++ b/source/MobFamilyCollecter.h
@@ -0,0 +1,40 @@
+
+#pragma once
+
+#include <map>
+#include <set>
+#include "BlockID.h"
+#include "Mobs/Monster.h" //this is a side-effect of keeping Mobfamily inside Monster class. I'd prefer to keep both (Mobfamily and Monster) inside a "Monster" namespace MG TODO : do it
+
+class cChunk;
+
+
+// This class is used to collect, for each Mob, what is it's family. It was first
+// being designed to check the caps of the mobs (no more than ... hostile mob in the world)
+//
+// as side effects : it also know what is the spawnrate of each family : MG TODO relocate
+class cMobFamilyCollecter
+{
+protected :
+ std::map<cMonster::eFamily,std::set<cMonster*> > m_Mobs;
+
+public :
+ // collect a mob
+ void CollectMob(cMonster& a_Monster);
+
+ // return the number of mobs for this family
+ int getNumberOfCollectedMobs(cMonster::eFamily a_Family);
+
+public :
+ typedef const std::set<cMonster::eFamily> tMobFamilyList;
+ static tMobFamilyList& m_AllFamilies();
+
+public :
+ typedef const std::map<cMonster::eFamily,int> tMobSpawRate;
+ static tMobSpawRate& m_SpawnRate();
+
+protected :
+ static tMobFamilyList initMobFamilyBeforeCx11();
+ static tMobSpawRate initMobSpawnRateBeforeCx11();
+};
+