diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-27 22:35:13 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-11-27 22:35:13 +0100 |
commit | a6630d32394120a78af56bc612fa3c3449283248 (patch) | |
tree | 2c791266b0f213cd56961299da8d2258b8f85d8e /source/MobCensus.cpp | |
parent | Fixed spawn point being generally in an ocean (diff) | |
parent | Voronoi-related biomegens use the new cVoronoiMap class. (diff) | |
download | cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.gz cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.bz2 cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.lz cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.xz cuberite-a6630d32394120a78af56bc612fa3c3449283248.tar.zst cuberite-a6630d32394120a78af56bc612fa3c3449283248.zip |
Diffstat (limited to 'source/MobCensus.cpp')
-rw-r--r-- | source/MobCensus.cpp | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/source/MobCensus.cpp b/source/MobCensus.cpp deleted file mode 100644 index 66b5932bc..000000000 --- a/source/MobCensus.cpp +++ /dev/null @@ -1,92 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "MobCensus.h" - - - - - -void cMobCensus::CollectMob(cMonster & a_Monster, cChunk & a_Chunk, double a_Distance) -{ - m_ProximityCounter.CollectMob(a_Monster, a_Chunk, a_Distance); - m_MobFamilyCollecter.CollectMob(a_Monster); -} - - - - - -bool cMobCensus::IsCapped(cMonster::eFamily a_MobFamily) -{ - bool toReturn = true; - const int ratio = 319; // this should be 256 as we are only supposed to take account from chunks that are in 17x17 from a player - // but for now, we use all chunks loaded by players. that means 19 x 19 chunks. That's why we use 256 * (19*19) / (17*17) = 319 - // MG TODO : code the correct count - if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily)) - { - return false; - } - return true; -} - - - - - -int cMobCensus::GetCapMultiplier(cMonster::eFamily a_MobFamily) -{ - switch (a_MobFamily) - { - case cMonster::mfHostile: return 79; - case cMonster::mfPassive: return 11; - case cMonster::mfAmbient: return 16; - case cMonster::mfWater: return 5; - } - ASSERT(!"Unhandled mob family"); - return -1; -} - - - - - -void cMobCensus::CollectSpawnableChunk(cChunk & a_Chunk) -{ - m_EligibleForSpawnChunks.insert(&a_Chunk); -} - - - - - -int cMobCensus::GetNumChunks(void) -{ - return m_EligibleForSpawnChunks.size(); -} - - - - - -cMobProximityCounter & cMobCensus::GetProximityCounter(void) -{ - return m_ProximityCounter; -} - - - - - -void cMobCensus::Logd() -{ - LOGD("Hostile mobs : %d %s", m_MobFamilyCollecter.GetNumberOfCollectedMobs(cMonster::mfHostile), IsCapped(cMonster::mfHostile) ? "(capped)" : ""); - LOGD("Ambient mobs : %d %s", m_MobFamilyCollecter.GetNumberOfCollectedMobs(cMonster::mfAmbient), IsCapped(cMonster::mfAmbient) ? "(capped)" : ""); - LOGD("Water mobs : %d %s", m_MobFamilyCollecter.GetNumberOfCollectedMobs(cMonster::mfWater), IsCapped(cMonster::mfWater) ? "(capped)" : ""); - LOGD("Passive mobs : %d %s", m_MobFamilyCollecter.GetNumberOfCollectedMobs(cMonster::mfPassive), IsCapped(cMonster::mfPassive) ? "(capped)" : ""); -} - - - - - |