From 13144a08e496b89b34093ffd3d810d3442df3c44 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Thu, 14 May 2020 23:15:35 +0100 Subject: Enable some more clang-tidy linter checks (#4738) * Avoid inefficient AString -> c_str() -> AString round trip * Avoid redundant string init expressions * Avoid unnecessary return, continue, etc. * Add .clang-format to help with clang-tidy fix-its * Avoid unnecessary passing by value * Avoid unnecessary local copying * Avoid copying in range-for loops * Avoid over-complicated boolean expressions * Some violations missed by my local clang-tidy * Allow unnecessary continue statements * Add brackets * Another expression missed locally * Move BindingsProcessor call into clang-tidy.sh and add space * Fix pushd not found error * Different grouping of CheckBlockInteractionRate --- src/MobCensus.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/MobCensus.cpp') diff --git a/src/MobCensus.cpp b/src/MobCensus.cpp index 5340c089d..1069a964e 100644 --- a/src/MobCensus.cpp +++ b/src/MobCensus.cpp @@ -22,11 +22,8 @@ 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 - if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily)) - { - return false; - } - return true; + const auto MobCap = ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio); + return (MobCap < m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily)); } -- cgit v1.2.3