refactor(Core/Misc): fabs() to std::fabs() (#9790)

- prefer std functions over C functions
This commit is contained in:
Kitzunu
2022-01-01 00:41:00 +01:00
committed by GitHub
parent ac99eb48e1
commit 913e65f97f
26 changed files with 43 additions and 43 deletions

View File

@@ -1766,7 +1766,7 @@ public:
if (summoner->GetMap()->isInLineOfSight(summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ() + 10.0f, destX, destY, summoner->GetPositionZ() + 10.0f, summoner->GetPhaseMask(), LINEOFSIGHT_ALL_CHECKS) && destX > 4585.0f && destY > 2716.0f && destY < 2822.0f)
{
float destZ = summoner->GetMapHeight(summoner->GetPhaseMask(), destX, destY, summoner->GetPositionZ());
if (fabs(destZ - summoner->GetPositionZ()) < 10.0f) // valid z found
if (std::fabs(destZ - summoner->GetPositionZ()) < 10.0f) // valid z found
{
dest._position.Relocate(destX, destY, destZ);
return;

View File

@@ -1635,7 +1635,7 @@ public:
if (floorZ > 190.0f) destZ = floorZ + 25.0f;
else destZ = me->GetPositionZ() + 25.0f;
me->GetMotionMaster()->MoveTakeoff(0, me->GetPositionX(), me->GetPositionY(), destZ, me->GetSpeed(MOVE_RUN));
float moveTime = fabs(destZ - me->GetPositionZ()) / (me->GetSpeed(MOVE_RUN) * 0.001f);
float moveTime = std::fabs(destZ - me->GetPositionZ()) / (me->GetSpeed(MOVE_RUN) * 0.001f);
_events.ScheduleEvent(EVENT_ICY_BLAST, uint32(moveTime) + urand(60000, 70000));
_events.ScheduleEvent(EVENT_ICY_BLAST_CAST, uint32(moveTime) + 250);
break;

View File

@@ -850,7 +850,7 @@ public:
if( me->GetUInt32Value(UNIT_NPC_EMOTESTATE) != EMOTE_STATE_WORK )
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_WORK);
if (fabs(me->GetOrientation() - me->GetAngle(c)) > M_PI / 4)
if (std::fabs(me->GetOrientation() - me->GetAngle(c)) > M_PI / 4)
me->SetFacingToObject(c);
c->AI()->SetData(2, 0);

View File

@@ -2361,7 +2361,7 @@ public:
}
Unit* _target = ObjectAccessor::GetUnit(*owner, _targetGUID);
if (!_target || !_target->IsAlive() || fabs(owner->GetPositionZ() - _target->GetPositionZ()) > 10.0f) // Target or owner underground
if (!_target || !_target->IsAlive() || std::fabs(owner->GetPositionZ() - _target->GetPositionZ()) > 10.0f) // Target or owner underground
{
SetDuration(0);
return;