summaryrefslogtreecommitdiffstats
path: root/src/MobCensus.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
committerAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
commitcb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch)
treef647b20e1823f1846af88e832cf82a4a02e96e69 /src/MobCensus.cpp
parentImprove clang-format config file, remove automatically enforced code style from contrib guide. (diff)
downloadcuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.gz
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.bz2
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.lz
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.xz
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.tar.zst
cuberite-cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a.zip
Diffstat (limited to 'src/MobCensus.cpp')
-rw-r--r--src/MobCensus.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/MobCensus.cpp b/src/MobCensus.cpp
index d6db2f9e5..c7c1e7c81 100644
--- a/src/MobCensus.cpp
+++ b/src/MobCensus.cpp
@@ -19,9 +19,10 @@ void cMobCensus::CollectMob(cMonster & a_Monster, cChunk & a_Chunk, double a_Dis
bool cMobCensus::IsCapped(cMonster::eFamily a_MobFamily)
{
- const int ratio = 319; // This should be 256 as we are only supposed to take account from chunks that are in 17 x 17 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
+ const int ratio = 319; // This should be 256 as we are only supposed to take account from chunks that are in 17 x
+ // 17 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
const auto MobCap = ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio);
return (MobCap < m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily));
}
@@ -79,13 +80,24 @@ cMobProximityCounter & cMobCensus::GetProximityCounter(void)
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)" : "");
+ 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)" : ""
+ );
}
-
-
-
-
-