refactor(Core/Misc): abs() to std::abs() (#9789)

This commit is contained in:
Kitzunu
2021-12-31 23:29:39 +01:00
committed by GitHub
parent fe9305c724
commit ac99eb48e1
25 changed files with 60 additions and 60 deletions

View File

@@ -644,9 +644,9 @@ public:
if (newmoney > MAX_MONEY_AMOUNT)
newmoney = MAX_MONEY_AMOUNT;
handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(moneyToAdd), handler->GetNameLink(target).c_str());
handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, std::abs(moneyToAdd), handler->GetNameLink(target).c_str());
if (handler->needReportToTarget(target))
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), abs(moneyToAdd));
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), std::abs(moneyToAdd));
target->SetMoney(newmoney);
}
}

View File

@@ -111,7 +111,7 @@ public:
if (dist(xn, yn, xh, yh) >= dist(xn, yn, xp, yp) || dist(xp, yp, xh, yh) >= dist(xn, yn, xp, yp))
return false;
// check distance from the beam
return (abs((xn - xp) * yh + (yp - yn) * xh - xn * yp + xp * yn) / dist(xn, yn, xp, yp) < 1.5f);
return (std::abs((xn - xp) * yh + (yp - yn) * xh - xn * yp + xp * yn) / dist(xn, yn, xp, yp) < 1.5f);
}
float dist(float xa, float ya, float xb, float yb) // auxiliary method for distance

View File

@@ -270,7 +270,7 @@ public:
Position pos = rift->GetNearPosition(10.0f, 2 * M_PI * rand_norm());
if (TempSummon* summon = instance->SummonCreature(abs(entry), pos))
if (TempSummon* summon = instance->SummonCreature(std::abs(entry), pos))
{
summon->SetTempSummonType(TEMPSUMMON_CORPSE_TIMED_DESPAWN);
summon->SetTimer(3 * MINUTE * IN_MILLISECONDS);

View File

@@ -216,10 +216,10 @@ public:
if (ArchavonDeath && EmalonDeath && KoralonDeath)
{
// instance difficulty check is already done in db (achievement_criteria_data)
// int() for Visual Studio, compile errors with abs(time_t)
return (abs(int(ArchavonDeath - EmalonDeath)) < MINUTE && \
abs(int(EmalonDeath - KoralonDeath)) < MINUTE && \
abs(int(KoralonDeath - ArchavonDeath)) < MINUTE);
// int() for Visual Studio, compile errors with std::abs(time_t)
return (std::abs(int(ArchavonDeath - EmalonDeath)) < MINUTE && \
std::abs(int(EmalonDeath - KoralonDeath)) < MINUTE && \
std::abs(int(KoralonDeath - ArchavonDeath)) < MINUTE);
}
break;
default:

View File

@@ -245,7 +245,7 @@ public:
}
else
{
if (me->GetDistance(me->GetHomePosition()) < 40.0f && abs(me->GetPositionZ() - me->GetHomePosition().GetPositionZ()) < 5.0f)
if (me->GetDistance(me->GetHomePosition()) < 40.0f && std::abs(me->GetPositionZ() - me->GetHomePosition().GetPositionZ()) < 5.0f)
{
rage = false;
me->RemoveAurasDueToSpell(SPELL_IOCBOSS_RAGE);