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

View File

@@ -55,6 +55,7 @@
#include "Vehicle.h"
#include "World.h"
#include "WorldPacket.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
@@ -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;
}