1
0
cuberite-2a/source/MobFamilyCollecter.h

50 lines
1.1 KiB
C
Raw Normal View History

#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
2013-10-18 18:02:53 +00:00
// fwd:
class cChunk;
2013-10-18 18:02:53 +00:00
/** 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
{
public :
2013-10-18 18:02:53 +00:00
typedef const std::set<cMonster::eFamily> tMobFamilyList;
typedef const std::map<cMonster::eFamily,int> tMobSpawRate;
// collect a mob
2013-10-18 18:02:53 +00:00
void CollectMob(cMonster & a_Monster);
// return the number of mobs for this family
2013-10-18 18:02:53 +00:00
int GetNumberOfCollectedMobs(cMonster::eFamily a_Family);
2013-10-18 18:02:53 +00:00
static tMobFamilyList & m_AllFamilies(void);
2013-10-18 18:02:53 +00:00
static tMobSpawRate & m_SpawnRate(void);
protected :
2013-10-18 18:02:53 +00:00
std::map<cMonster::eFamily, std::set<cMonster*> > m_Mobs;
static tMobFamilyList InitMobFamilyBeforeCx11(void);
static tMobSpawRate InitMobSpawnRateBeforeCx11(void);
} ;