diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index 6696e66b9..b7c0fccd2 100644 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -21,6 +21,7 @@ #include "Log.h" #include "ObjectMgr.h" #include "Util.h" +#include #include #include @@ -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) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index bc044e5e3..c1c1e372e 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -83,6 +83,7 @@ #include "World.h" #include "WorldPacket.h" #include "WorldSession.h" +#include /// @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)) { diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ec64f1bba..9d2e77854 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -69,7 +69,7 @@ #include "Vehicle.h" #include "World.h" #include "WorldPacket.h" -#include +#include 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) diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 0623001e8..3873b82a3 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -28,6 +28,7 @@ #include "UpdateData.h" #include "WorldPacket.h" #include "WorldSession.h" +#include void WorldSession::HandleSplitItemOpcode(WorldPacket& recvData) { @@ -1111,7 +1112,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry) } // reputation discount - int32 price = item->IsGoldRequired(itemTemplate) ? uint32(floor(itemTemplate->BuyPrice * discountMod)) : 0; + int32 price = item->IsGoldRequired(itemTemplate) ? uint32(std::floor(itemTemplate->BuyPrice * discountMod)) : 0; data << uint32(slot + 1); // client expects counting to start at 1 data << uint32(item->item); diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index b226b9ed0..5f68af663 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -32,6 +32,7 @@ #include "UpdateMask.h" #include "WorldPacket.h" #include "WorldSession.h" +#include enum StableResultCode { @@ -164,7 +165,7 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle) data << uint32(tSpell->spell); // learned spell (or cast-spell in profession case) data << uint8(state == TRAINER_SPELL_GREEN_DISABLED ? TRAINER_SPELL_GREEN : state); - data << uint32(floor(tSpell->spellCost * fDiscountMod)); + data << uint32(std::floor(tSpell->spellCost * fDiscountMod)); data << uint32(primary_prof_first_rank && can_learn_primary_prof ? 1 : 0); // primary prof. learn confirmation dialog @@ -247,7 +248,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) return; // apply reputation discount - uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(unit))); + uint32 nSpellCost = uint32(std::floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(unit))); // check money requirement if (!_player->HasEnoughMoney(nSpellCost)) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3c8ee5076..60d153f9d 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -55,6 +55,7 @@ #include "Vehicle.h" #include "World.h" #include "WorldPacket.h" +#include /// @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 @@ -900,7 +901,7 @@ uint64 Spell::CalculateDelayMomentForDst() const { float speed = m_targets.GetSpeedXY(); if (speed > 0.0f) - return (uint64)floor(m_targets.GetDist2d() / speed * 1000.0f); + return (uint64)std::floor(m_targets.GetDist2d() / speed * 1000.0f); } else if (m_spellInfo->Speed > 0.0f) { @@ -1441,7 +1442,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici bool inwater = false; bool wcol = false; const float step = 2.0f; - const uint8 numChecks = ceil(fabs(distance / step)); + const uint8 numChecks = std::ceil(std::fabs(distance / step)); const float DELTA_X = (destx - pos.GetPositionX()) / numChecks; const float DELTA_Y = (desty - pos.GetPositionY()) / numChecks; int j = 1; @@ -2462,7 +2463,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= if (dist < 5.0f) dist = 5.0f; - targetInfo.timeDelay = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f); + targetInfo.timeDelay = (uint64) std::floor(dist / m_spellInfo->Speed * 1000.0f); // Calculate minimum incoming time if (m_delayMoment == 0 || m_delayMoment > targetInfo.timeDelay) @@ -2561,7 +2562,7 @@ void Spell::AddGOTarget(GameObject* go, uint32 effectMask) float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ()); if (dist < 5.0f) dist = 5.0f; - target.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f)); + target.timeDelay = uint64(std::floor(dist / m_spellInfo->Speed * 1000.0f)); if (m_delayMoment == 0 || m_delayMoment > target.timeDelay) m_delayMoment = target.timeDelay; } diff --git a/src/server/game/Time/UpdateTime.cpp b/src/server/game/Time/UpdateTime.cpp index 3c4886376..75244b19e 100644 --- a/src/server/game/Time/UpdateTime.cpp +++ b/src/server/game/Time/UpdateTime.cpp @@ -20,6 +20,7 @@ #include "Log.h" #include "Timer.h" #include +#include #include // create instance @@ -87,12 +88,12 @@ uint32 UpdateTime::GetPercentile(uint8 p) double index = (double(p) / 100.0) * (GetDatasetSize() - 1); // If the index is an integer, return the value at that index - if (index == floor(index)) + if (index == std::floor(index)) return _orderedUpdateTimeDataTable[index]; // Otherwise, perform linear interpolation - int lowerIndex = floor(index); - int upperIndex = ceil(index); + int lowerIndex = std::floor(index); + int upperIndex = std::ceil(index); double fraction = index - lowerIndex; return _orderedUpdateTimeDataTable[lowerIndex] * (1 - fraction) + _orderedUpdateTimeDataTable[upperIndex] * fraction; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index ffdb70f6f..dbe0f1263 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -234,7 +234,7 @@ public: me->SetInFront(me->GetVictim()); } /*if (float dist = me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f) dist = 5.0f; - SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/ + SDisruptAOEVisual_Timer = 1000 + std::floor(dist / 30 * 1000.0f);*/ events.ScheduleEvent(EVENT_STATIC_DISRUPTION, urand(10000, 18000)); break; } diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index 3a4ea4d30..56aa104a6 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -34,6 +34,7 @@ #include "SpellScriptLoader.h" #include "Vehicle.h" #include "World.h" +#include enum eWGqueuenpctext { @@ -1089,7 +1090,7 @@ class spell_wg_reduce_damage_by_distance : public SpellScript float maxDistance = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); // Xinef: always stored in EFFECT_0 float distance = std::min(GetHitUnit()->GetDistance(*GetExplTargetDest()), maxDistance); - int32 damage = std::max(0, int32(GetHitDamage() - floor(GetHitDamage() * (distance / maxDistance)))); + int32 damage = std::max(0, int32(GetHitDamage() - std::floor(GetHitDamage() * (distance / maxDistance)))); SetHitDamage(damage); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index e77fa638f..3bca70883 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -35,6 +35,7 @@ #include "Unit.h" #include "Vehicle.h" #include +#include /* * Scripts for spells with SPELLFAMILY_GENERIC which cannot be included in AI script file * of creature using it or can't be bound to any player class. @@ -4255,7 +4256,7 @@ class spell_gen_gift_of_naaru : public AuraScript break; } - int32 healTick = floor(heal / aurEff->GetTotalTicks()); + int32 healTick = std::floor(heal / aurEff->GetTotalTicks()); amount += int32(std::max(healTick, 0)); }