diff options
author | madmaxoft <github@xoft.cz> | 2013-10-18 20:02:53 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-10-18 20:02:53 +0200 |
commit | ca538d5323bbd8b33d87ad8ee8954529e0cf7c61 (patch) | |
tree | ce53e154ea9fe4889f6b8593811a718574507d23 /source/MobCensus.h | |
parent | StringToItem() recognizes "ItemName:Dmg" strings. (diff) | |
download | cuberite-ca538d5323bbd8b33d87ad8ee8954529e0cf7c61.tar cuberite-ca538d5323bbd8b33d87ad8ee8954529e0cf7c61.tar.gz cuberite-ca538d5323bbd8b33d87ad8ee8954529e0cf7c61.tar.bz2 cuberite-ca538d5323bbd8b33d87ad8ee8954529e0cf7c61.tar.lz cuberite-ca538d5323bbd8b33d87ad8ee8954529e0cf7c61.tar.xz cuberite-ca538d5323bbd8b33d87ad8ee8954529e0cf7c61.tar.zst cuberite-ca538d5323bbd8b33d87ad8ee8954529e0cf7c61.zip |
Diffstat (limited to 'source/MobCensus.h')
-rw-r--r-- | source/MobCensus.h | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/source/MobCensus.h b/source/MobCensus.h index 8aa8f3a6c..7606efcea 100644 --- a/source/MobCensus.h +++ b/source/MobCensus.h @@ -4,55 +4,63 @@ #include "MobProximityCounter.h" #include "MobFamilyCollecter.h" + + + +// fwd: class cChunk; class cMonster; -// This class is used to collect, for each Mob, what is the distance of the closest player -// it was first being designed in order to make mobs spawn / despawn / act -// as the behaviour and even life of mobs depends on the distance to closest player -// -// as side effect : it also collect the chunks that are elligible for spawning -// as side effect 2 : it also know the caps for mobs number and can compare census to this numbers -class cMobCensus -{ -public : - cMobCensus(); -protected : - cMobProximityCounter m_ProximityCounter; - cMobFamilyCollecter m_MobFamilyCollecter; - typedef const std::map<cMonster::eFamily,int> tCapMultipliersMap; - static tCapMultipliersMap& m_CapMultipliers(); - std::set<cChunk*> m_EligibleForSpawnChunks; - // count the chunks that are elligible to spawn (for now, the loaded valide not null chunks) - int getChunkNb(); +/** This class is used to collect information, for each Mob, what is the distance of the closest player +it was first being designed in order to make mobs spawn / despawn / act +as the behaviour and even life of mobs depends on the distance to closest player +as side effect : it also collect the chunks that are elligible for spawning +as side effect 2 : it also know the caps for mobs number and can compare census to this numbers +*/ +class cMobCensus +{ public: typedef const std::map<cMonster::eFamily,int> tMobSpawnRate; - static tMobSpawnRate& m_SpawnRate(); + static tMobSpawnRate & m_SpawnRate(void); - // return the nested proximity counter - cMobProximityCounter& getProximityCounter(); + /// Returns the nested proximity counter + cMobProximityCounter & GetProximityCounter(void); -public : // collect an elligible Chunk for Mob Spawning // MG TODO : code the correct rule (not loaded chunk but short distant from players) - void CollectSpawnableChunk(cChunk& a_Chunk); + void CollectSpawnableChunk(cChunk & a_Chunk); - // collect a mob - it's distance to player, it's family ... + /// Collect a mob - it's distance to player, it's family ... void CollectMob(cMonster& a_Monster, cChunk& a_Chunk, double a_Distance); - // return true if the family is caped (i.e. there is more mobs of this family than max) - bool isCaped(cMonster::eFamily a_MobFamily); + /// Returns true if the family is capped (i.e. there are more mobs of this family than max) + bool IsCapped(cMonster::eFamily a_MobFamily); + + /// log the results of census to server console + void Logd(void); + +protected : + cMobProximityCounter m_ProximityCounter; + cMobFamilyCollecter m_MobFamilyCollecter; + + typedef const std::map<cMonster::eFamily,int> tCapMultipliersMap; + + static tCapMultipliersMap & m_CapMultipliers(void); + + std::set<cChunk *> m_EligibleForSpawnChunks; + + /// Returns the number of chunks that are elligible for spawning (for now, the loaded, valid chunks) + int GetNumChunks(); + + static tCapMultipliersMap CapMultiplierInitializerBeforeCx11(void); + static tCapMultipliersMap MobSpawnRateInitializerBeforeCx11(void); +} ; + - // log the results of census - void logd(); -protected : - static tCapMultipliersMap CapMultiplierInitializerBeforeCx11(); - static tCapMultipliersMap MobSpawnRateInitializerBeforeCx11(); -}; |