refactor(Core/Misc): ceil() to std::ceil() (#9791)

- prefer std functions over C functions
This commit is contained in:
Kitzunu
2022-01-03 14:11:39 +01:00
committed by GitHub
parent 61649b7e6d
commit f04709a326
8 changed files with 13 additions and 13 deletions

View File

@@ -214,7 +214,7 @@ struct CreatureBaseStats
uint32 GenerateHealth(CreatureTemplate const* info) const
{
return uint32(ceil(BaseHealth[info->expansion] * info->ModHealth));
return uint32(std::ceil(BaseHealth[info->expansion] * info->ModHealth));
}
uint32 GenerateMana(CreatureTemplate const* info) const
@@ -223,12 +223,12 @@ struct CreatureBaseStats
if (!BaseMana)
return 0;
return uint32(ceil(BaseMana * info->ModMana));
return uint32(std::ceil(BaseMana * info->ModMana));
}
uint32 GenerateArmor(CreatureTemplate const* info) const
{
return uint32(ceil(BaseArmor * info->ModArmor));
return uint32(std::ceil(BaseArmor * info->ModArmor));
}
float GenerateBaseDamage(CreatureTemplate const* info) const

View File

@@ -5926,7 +5926,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
else
victim_guid.Clear(); // Don't show HK: <rank> message, only log.
honor_f = ceil(Acore::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey));
honor_f = std::ceil(Acore::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey));
// count the number of playerkills in one day
ApplyModUInt32Value(PLAYER_FIELD_KILLS, 1, true);
@@ -12129,7 +12129,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const
time_t now = time(nullptr);
// 0..2 full period
// should be ceil(x)-1 but not floor(x)
// should be std::ceil(x)-1 but not floor(x)
uint64 count = (now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now) / DEATH_EXPIRE_STEP : 0;
return copseReclaimDelay[count];
}

View File

@@ -9311,7 +9311,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
uint8 fofRank = sSpellMgr->GetSpellRank(triggeredByAura->GetId());
uint8 fbRank = sSpellMgr->GetSpellRank(aurEff->GetId());
uint8 chance = uint8(ceil(fofRank * fbRank * 16.6f));
uint8 chance = uint8(std::ceil(fofRank * fbRank * 16.6f));
if (roll_chance_i(chance))
CastSpell(victim, aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true);