chore(Core/Misc): update floor and ceil to std (#19837)

This commit is contained in:
Kitzunu
2024-09-03 13:01:00 +02:00
committed by GitHub
parent de2bcbdabf
commit 9af86553c5
10 changed files with 28 additions and 20 deletions
@@ -21,6 +21,7 @@
#include "Log.h"
#include "ObjectMgr.h"
#include "Util.h"
#include <cmath>
#include <functional>
#include <vector>
@@ -105,7 +106,7 @@ uint32 GetItemEnchantMod(int32 entry)
}
//we could get here only if sum of all enchantment chances is lower than 100%
dRoll = (irand(0, (int)floor(fCount * 100) + 1)) / 100;
dRoll = (irand(0, (int)std::floor(fCount * 100) + 1)) / 100;
fCount = 0;
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
+2 -1
View File
@@ -83,6 +83,7 @@
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include <cmath>
/// @todo: this import is not necessary for compilation and marked as unused by the IDE
// however, for some reasons removing it would cause a damn linking issue
@@ -10804,7 +10805,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT
// reputation discount
price = uint32(floor(price * GetReputationPriceDiscount(creature)));
price = uint32(std::floor(price * GetReputationPriceDiscount(creature)));
if (!HasEnoughMoney(price))
{
+5 -5
View File
@@ -69,7 +69,7 @@
#include "Vehicle.h"
#include "World.h"
#include "WorldPacket.h"
#include <math.h>
#include <cmath>
float baseMoveSpeed[MAX_MOVE_TYPE] =
{
@@ -2013,14 +2013,14 @@ uint32 Unit::CalcArmorReducedDamage(Unit const* attacker, Unit const* victim, co
{
if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL
&& (*j)->IsAffectedOnSpell(spellInfo))
armor = floor(AddPct(armor, -(*j)->GetAmount()));
armor = std::floor(AddPct(armor, -(*j)->GetAmount()));
}
AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
{
if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
armor = floor(AddPct(armor, -(*j)->GetAmount()));
armor = std::floor(AddPct(armor, -(*j)->GetAmount()));
}
// Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
@@ -10980,7 +10980,7 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo)
float dist = GetDistance(magnet->GetPositionX(), magnet->GetPositionY(), magnet->GetPositionZ());
if (dist < 5.0f)
dist = 5.0f;
queueTime = magnet->m_Events.CalculateTime((uint64)floor(dist / spellInfo->Speed * 1000.0f));
queueTime = magnet->m_Events.CalculateTime((uint64)std::floor(dist / spellInfo->Speed * 1000.0f));
}
magnet->m_Events.AddEvent(new KillMagnetEvent(*magnet), queueTime);
@@ -13397,7 +13397,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const* spe
if (Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_PROC_PER_MINUTE, PPM);
return floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
return std::floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
}
void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)