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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 60 additions and 60 deletions

View file

@ -24,7 +24,7 @@ BigNumber::~BigNumber()
void BigNumber::SetDword(int32 val)
{
SetDword(uint32(abs(val)));
SetDword(uint32(std::abs(val)));
if (val < 0)
{
BN_set_negative(_bn, 1);

View file

@ -42,12 +42,12 @@
[[nodiscard]] inline float getSlopeAngle(float startX, float startY, float startZ, float destX, float destY, float destZ)
{
float floorDist = sqrt(pow(startY - destY, 2.0f) + pow(startX - destX, 2.0f));
return atan(abs(destZ - startZ) / abs(floorDist));
return atan(std::abs(destZ - startZ) / std::abs(floorDist));
}
[[nodiscard]] inline float getSlopeAngleAbs(float startX, float startY, float startZ, float destX, float destY, float destZ)
{
return abs(getSlopeAngle(startX, startY, startZ, destX, destY, destZ));
return std::abs(getSlopeAngle(startX, startY, startZ, destX, destY, destZ));
}
[[nodiscard]] inline double getCircleAreaByRadius(double radius)

View file

@ -207,7 +207,7 @@ void PetAI::UpdateAI(uint32 diff)
{
if (owner && owner->GetTypeId() == TYPEID_PLAYER && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget())
{
owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget());
owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), std::abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget());
// xinef: if spell was casted properly and we are in passive mode, handle return
if (!me->GetCharmInfo()->GetForcedSpell() && me->HasReactState(REACT_PASSIVE))

View file

@ -191,9 +191,9 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
else
{
if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid))))
if (!sObjectMgr->GetCreatureData(uint32(std::abs(temp.entryOrGuid))))
{
LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));
LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(std::abs(temp.entryOrGuid)));
continue;
}
}
@ -1280,7 +1280,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.entryOrGuid >= 0)
entry = uint32(e.entryOrGuid);
else {
entry = uint32(abs(e.entryOrGuid));
entry = uint32(std::abs(e.entryOrGuid));
CreatureData const* data = sObjectMgr->GetCreatureData(entry);
if (!data)
{

View file

@ -1085,7 +1085,7 @@ void BattlefieldWG::UpdateTenacity()
if (Player* newPlayer = ObjectAccessor::FindPlayer(*itr))
if ((newPlayer->GetTeamId() == TEAM_ALLIANCE && m_tenacityStack > 0) || (newPlayer->GetTeamId() == TEAM_HORDE && m_tenacityStack < 0))
{
newStack = std::min(abs(newStack), 20);
newStack = std::min(std::abs(newStack), 20);
uint32 buff_honor = GetHonorBuff(newStack);
newPlayer->SetAuraStack(SPELL_TENACITY, newPlayer, newStack);
if (buff_honor)
@ -1119,7 +1119,7 @@ void BattlefieldWG::UpdateTenacity()
if (newStack)
{
team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
newStack = std::min(abs(newStack), 20);
newStack = std::min(std::abs(newStack), 20);
uint32 buff_honor = GetHonorBuff(newStack);
for (GuidUnorderedSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)

View file

@ -89,7 +89,7 @@ bool BattlegroundQueue::SelectionPool::KickGroup(const uint32 size)
for (auto itr = groupToKick; itr != SelectedGroups.end(); ++itr)
{
// if proper size - overwrite to kick last one
if (abs(int32((*itr)->Players.size()) - (int32)size) <= 1)
if (std::abs(int32((*itr)->Players.size()) - (int32)size) <= 1)
{
groupToKick = itr;
foundProper = true;
@ -421,7 +421,7 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, const int32 aliFree, c
}
// balance the teams based on the difference allowed
while (abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
while (std::abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
{
// if results in more alliance players than horde:
if (aliDiff < hordeDiff)
@ -504,7 +504,7 @@ void BattlegroundQueue::FillPlayersToBGWithSpecific(Battleground* bg, const int3
}
// if free space differs too much, ballance
while (abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
while (std::abs(aliDiff - hordeDiff) > invDiff && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
{
// if results in more alliance players than horde:
if (aliDiff < hordeDiff)
@ -610,7 +610,7 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground* bgTemplate, BattlegroundB
return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
case BG_QUEUE_INVITATION_TYPE_BALANCED: // check difference between selection pools - if = 1 or less start.
return abs(static_cast<int32>(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) - static_cast<int32>(m_SelectionPools[TEAM_HORDE].GetPlayerCount())) <= 1 && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
return std::abs(static_cast<int32>(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount()) - static_cast<int32>(m_SelectionPools[TEAM_HORDE].GetPlayerCount())) <= 1 && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
case BG_QUEUE_INVITATION_TYPE_EVEN: // if both counts are same then it's an even match
return (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() == m_SelectionPools[TEAM_HORDE].GetPlayerCount()) && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;

View file

@ -931,7 +931,7 @@ void ConditionMgr::LoadConditions(bool isReload)
delete cond;
continue;
}
cond->ReferenceId = uint32(abs(iConditionTypeOrReference));
cond->ReferenceId = uint32(std::abs(iConditionTypeOrReference));
const char* rowType = "reference template";
if (iSourceTypeOrReferenceId >= 0)
@ -960,7 +960,7 @@ void ConditionMgr::LoadConditions(bool isReload)
if (iSourceTypeOrReferenceId < 0) // it is a reference template
{
uint32 uRefId = abs(iSourceTypeOrReferenceId);
uint32 uRefId = std::abs(iSourceTypeOrReferenceId);
if (ConditionReferenceStore.find(uRefId) == ConditionReferenceStore.end()) // make sure we have a list for our conditions, based on reference id
{
ConditionList mCondList;

View file

@ -41,7 +41,7 @@ struct ObjectPosSelector
float dist; // dist to central point (including central point size)
};
typedef std::multimap<float, UsedPos> UsedPosList; // abs(angle)->Node
typedef std::multimap<float, UsedPos> UsedPosList; // std::abs(angle)->Node
ObjectPosSelector(float x, float y, float size, float dist);

View file

@ -5799,7 +5799,7 @@ void Player::RewardReputation(Quest const* quest)
uint32 row = ((quest->RewardFactionValueId[i] < 0) ? 1 : 0) + 1;
if (QuestFactionRewEntry const* questFactionRewEntry = sQuestFactionRewardStore.LookupEntry(row))
{
uint32 field = abs(quest->RewardFactionValueId[i]);
uint32 field = std::abs(quest->RewardFactionValueId[i]);
rep = questFactionRewEntry->QuestRewFactionValue[field];
}
}

View file

@ -987,7 +987,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) const
for (Quest::PrevQuests::const_iterator iter = qInfo->prevQuests.begin(); iter != qInfo->prevQuests.end(); ++iter)
{
uint32 prevId = abs(*iter);
uint32 prevId = std::abs(*iter);
Quest const* qPrevInfo = sObjectMgr->GetQuestTemplate(prevId);

View file

@ -4399,7 +4399,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
// Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor)
if (item->GetItemRandomPropertyId())
{
ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId()));
ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(std::abs(item->GetItemRandomPropertyId()));
if (item_rand)
{
// Search enchant_amount
@ -4426,7 +4426,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
case ITEM_ENCHANTMENT_TYPE_RESISTANCE:
if (!enchant_amount)
{
ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId()));
ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(std::abs(item->GetItemRandomPropertyId()));
if (item_rand)
{
for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k)
@ -4446,7 +4446,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
{
if (!enchant_amount)
{
ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId()));
ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(std::abs(item->GetItemRandomPropertyId()));
if (item_rand_suffix)
{
for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k)
@ -5215,7 +5215,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
map = sMapMgr->CreateMap(mapId, this);
if (map)
{
auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(abs(transLowGUID));
auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(std::abs(transLowGUID));
if (bounds.first != bounds.second)
transGO = bounds.first->second->ToTransport();
}

View file

@ -4653,7 +4653,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RewardFactionId[j])
{
if (abs(qinfo->RewardFactionValueId[j]) > 9)
if (std::abs(qinfo->RewardFactionValueId[j]) > 9)
{
LOG_ERROR("sql.sql", "Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j + 1, qinfo->RewardFactionValueId[j]);
}
@ -4763,7 +4763,7 @@ void ObjectMgr::LoadQuests()
// fill additional data stores
if (qinfo->PrevQuestId)
{
if (_questTemplates.find(abs(qinfo->GetPrevQuestId())) == _questTemplates.end())
if (_questTemplates.find(std::abs(qinfo->GetPrevQuestId())) == _questTemplates.end())
{
LOG_ERROR("sql.sql", "Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId());
}

View file

@ -2807,7 +2807,7 @@ void Guild::_SendBankList(WorldSession* session /* = nullptr*/, uint8 tabId /*=
itemInfo.Slot = *itr;
itemInfo.ItemID = tabItem->GetEntry();
itemInfo.Count = int32(tabItem->GetCount());
itemInfo.Charges = int32(abs(tabItem->GetSpellCharges()));
itemInfo.Charges = int32(std::abs(tabItem->GetSpellCharges()));
itemInfo.EnchantmentID = int32(tabItem->GetEnchantmentId(PERM_ENCHANTMENT_SLOT));
itemInfo.Flags = tabItem->GetInt32Value(ITEM_FIELD_FLAGS);

View file

@ -1004,7 +1004,7 @@ bool PathGenerator::IsWalkableClimb(float x, float y, float z, float destX, floa
*/
bool PathGenerator::IsWalkableClimb(float x, float y, float z, float destX, float destY, float destZ, float sourceHeight)
{
float diffHeight = abs(destZ - z);
float diffHeight = std::abs(destZ - z);
float reqHeight = GetRequiredHeightToClimb(x, y, z, destX, destY, destZ, sourceHeight);
// check walkable slopes, based on unit height
return diffHeight <= reqHeight;

View file

@ -693,7 +693,7 @@ void Map::ScriptsProcess()
break;
case SF_CASTSPELL_SEARCH_CREATURE: // source -> creature with entry
uSource = source ? source->ToUnit() : nullptr;
uTarget = uSource ? GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : nullptr;
uTarget = uSource ? GetClosestCreatureWithEntry(uSource, std::abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : nullptr;
break;
}

View file

@ -461,7 +461,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (Item* castItem = playerCaster->GetItemByGuid(itemGUID))
if (castItem->GetItemSuffixFactor())
{
ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId()));
ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(std::abs(castItem->GetItemRandomPropertyId()));
if (item_rand_suffix)
{
for (uint8 k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; k++)

View file

@ -189,7 +189,7 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
{
AuraApplication* strongestApp = apply ? this : nullptr;
AuraEffect* strongestEff = apply ? aurEff : nullptr;
int32 amount = apply ? abs(aurEff->GetAmount()) : 0;
int32 amount = apply ? std::abs(aurEff->GetAmount()) : 0;
Unit* target = GetTarget();
Unit::AuraEffectList const& auraList = target->GetAuraEffectsByType(aurEff->GetAuraType());
for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter)
@ -207,7 +207,7 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
if (!aurApp)
continue;
if (amount < abs((*iter)->GetForcedAmount()))
if (amount < std::abs((*iter)->GetForcedAmount()))
{
// xinef: if we have strongest aura and it is active, turn it off
// xinef: otherwise just save new aura;
@ -220,7 +220,7 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
}
strongestApp = aurApp;
strongestEff = (*iter);
amount = abs((*iter)->GetAmount());
amount = std::abs((*iter)->GetAmount());
}
// xinef: itered aura is weaker, deactivate if active
else if (aurApp->IsActive((*iter)->GetEffIndex()))
@ -1930,11 +1930,11 @@ bool Aura::IsAuraStronger(Aura const* newAura) const
continue;
// xinef: assume that all spells are either positive or negative, otherwise they should not be in one group
int32 curValue = abs(thisEffect->GetAmount());
if (curValue < abs(newEffect->GetAmount()))
int32 curValue = std::abs(thisEffect->GetAmount());
if (curValue < std::abs(newEffect->GetAmount()))
return true;
if (curValue == abs(newEffect->GetAmount()))
if (curValue == std::abs(newEffect->GetAmount()))
if(!IsPassive() && !IsPermanent() && GetDuration() < newAura->GetDuration())
return true;
}

View file

@ -4873,7 +4873,7 @@ void Spell::TakeCastItem()
// item has charges left
if (charges)
{
(charges > 0) ? --charges : ++charges; // abs(charges) less at 1 after use
(charges > 0) ? --charges : ++charges; // std::abs(charges) less at 1 after use
if (proto->Stackable == 1)
m_CastItem->SetSpellCharges(i, charges);
m_CastItem->SetState(ITEM_CHANGED, m_caster->ToPlayer());
@ -5143,7 +5143,7 @@ void Spell::TakeReagents()
{
// CastItem will be used up and does not count as reagent
int32 charges = m_CastItem->GetSpellCharges(s);
if (castItemTemplate->Spells[s].SpellCharges < 0 && abs(charges) < 2)
if (castItemTemplate->Spells[s].SpellCharges < 0 && std::abs(charges) < 2)
{
++itemcount;
break;
@ -6839,7 +6839,7 @@ SpellCastResult Spell::CheckItems()
{
// CastItem will be used up and does not count as reagent
int32 charges = m_CastItem->GetSpellCharges(s);
if (proto->Spells[s].SpellCharges < 0 && abs(charges) < 2)
if (proto->Spells[s].SpellCharges < 0 && std::abs(charges) < 2)
{
++itemcount;
break;

View file

@ -1652,10 +1652,10 @@ bool SpellInfo::IsStrongerAuraActive(Unit const* caster, Unit const* target) con
if (player->m_spellModTakingSpell && player->m_spellModTakingSpell->m_spellInfo->Id == Id)
basePoints = player->m_spellModTakingSpell->GetSpellValue()->EffectBasePoints[i];
int32 curValue = abs(Effects[i].CalcValue(caster, &basePoints));
int32 curValue = std::abs(Effects[i].CalcValue(caster, &basePoints));
int32 auraValue = (sFlag & SPELL_GROUP_SPECIAL_FLAG_BASE_AMOUNT_CHECK) ?
abs((*iter)->GetSpellInfo()->Effects[(*iter)->GetEffIndex()].CalcValue((*iter)->GetCaster())) :
abs((*iter)->GetAmount());
std::abs((*iter)->GetSpellInfo()->Effects[(*iter)->GetEffIndex()].CalcValue((*iter)->GetCaster())) :
std::abs((*iter)->GetAmount());
// xinef: for same spells, divide amount by stack amount
if (Id == (*iter)->GetId())
@ -2291,14 +2291,14 @@ int32 SpellInfo::GetDuration() const
{
if (!DurationEntry)
return 0;
return (DurationEntry->Duration[0] == -1) ? -1 : abs(DurationEntry->Duration[0]);
return (DurationEntry->Duration[0] == -1) ? -1 : std::abs(DurationEntry->Duration[0]);
}
int32 SpellInfo::GetMaxDuration() const
{
if (!DurationEntry)
return 0;
return (DurationEntry->Duration[2] == -1) ? -1 : abs(DurationEntry->Duration[2]);
return (DurationEntry->Duration[2] == -1) ? -1 : std::abs(DurationEntry->Duration[2]);
}
uint32 SpellInfo::CalcCastTime(Unit* caster, Spell* spell) const

View file

@ -2261,16 +2261,16 @@ void SpellMgr::LoadSpellLinked()
int32 effect = fields[1].GetInt32();
int32 type = fields[2].GetUInt8();
SpellInfo const* spellInfo = GetSpellInfo(abs(trigger));
SpellInfo const* spellInfo = GetSpellInfo(std::abs(trigger));
if (!spellInfo)
{
LOG_ERROR("sql.sql", "Spell %u listed in `spell_linked_spell` does not exist", abs(trigger));
LOG_ERROR("sql.sql", "Spell %u listed in `spell_linked_spell` does not exist", std::abs(trigger));
continue;
}
spellInfo = GetSpellInfo(abs(effect));
spellInfo = GetSpellInfo(std::abs(effect));
if (!spellInfo)
{
LOG_ERROR("sql.sql", "Spell %u listed in `spell_linked_spell` does not exist", abs(effect));
LOG_ERROR("sql.sql", "Spell %u listed in `spell_linked_spell` does not exist", std::abs(effect));
continue;
}
@ -2576,16 +2576,16 @@ void SpellMgr::LoadSpellAreas()
if (spellArea.auraSpell)
{
SpellInfo const* spellInfo = GetSpellInfo(abs(spellArea.auraSpell));
SpellInfo const* spellInfo = GetSpellInfo(std::abs(spellArea.auraSpell));
if (!spellInfo)
{
LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell));
LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, std::abs(spellArea.auraSpell));
continue;
}
if (uint32(abs(spellArea.auraSpell)) == spellArea.spellId)
if (uint32(std::abs(spellArea.auraSpell)) == spellArea.spellId)
{
LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell));
LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, std::abs(spellArea.auraSpell));
continue;
}
@ -2655,7 +2655,7 @@ void SpellMgr::LoadSpellAreas()
// for search at aura apply
if (spellArea.auraSpell)
mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(abs(spellArea.auraSpell), sa));
mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(std::abs(spellArea.auraSpell), sa));
++count;
} while (result->NextRow());

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);