diff options
author | mgueydan <gueydan.mathieuÃ@gmail.com> | 2013-09-07 22:19:56 +0200 |
---|---|---|
committer | mgueydan <gueydan.mathieuÃ@gmail.com> | 2013-09-07 22:19:56 +0200 |
commit | d2eb58f27780a3c65fedd0d21d152ee8866ebb86 (patch) | |
tree | 05160377f78b97b4916956eebfd07f8a830a8916 /source/MobFamilyCollecter.h | |
parent | Adding a getType in Monster that return an enum instead of an int or char (diff) | |
download | cuberite-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.h')
-rw-r--r-- | source/MobFamilyCollecter.h | 40 |
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(); +}; + |