mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 03:32:28 -04:00
Core/Spells: Suppress a few float/double/int conversion warnings in Player::GetSpellModValues
This commit is contained in:
@@ -22623,7 +22623,7 @@ void Player::SendRemoveControlBar() const
|
||||
SendDirectMessage(packet.Write());
|
||||
}
|
||||
|
||||
uint32 Player::IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier const* mod, Spell const* spell)
|
||||
int32 Player::IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier const* mod, Spell const* spell)
|
||||
{
|
||||
if (!mod || !spellInfo)
|
||||
return 0;
|
||||
@@ -22670,8 +22670,7 @@ uint32 Player::IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier co
|
||||
return spellInfo->IsAffectedBySpellMod(mod);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, T base, int32* flat, float* pct) const
|
||||
void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, double base, int32* flat, float* pct) const
|
||||
{
|
||||
ASSERT(flat && pct);
|
||||
|
||||
@@ -22735,7 +22734,7 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
|
||||
if (!IsAffectedBySpellmod(spellInfo, mod, spell))
|
||||
continue;
|
||||
|
||||
if (base < T(10000) && static_cast<SpellModifierByClassMask*>(mod)->value <= -100)
|
||||
if (base < 10000.0 && static_cast<SpellModifierByClassMask*>(mod)->value <= -100)
|
||||
{
|
||||
modInstantSpell = mod;
|
||||
break;
|
||||
@@ -22749,7 +22748,7 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
|
||||
if (!IsAffectedBySpellmod(spellInfo, mod, spell))
|
||||
continue;
|
||||
|
||||
if (base < T(10000) && static_cast<SpellPctModifierByLabel*>(mod)->value.ModifierValue <= -1.0f)
|
||||
if (base < 10000.0 && static_cast<SpellPctModifierByLabel*>(mod)->value.ModifierValue <= -1.0f)
|
||||
{
|
||||
modInstantSpell = mod;
|
||||
break;
|
||||
@@ -22810,7 +22809,7 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
|
||||
|
||||
for (SpellModifier* mod : spellModTypeRange(SPELLMOD_FLAT))
|
||||
{
|
||||
uint32 applyCount = IsAffectedBySpellmod(spellInfo, mod, spell);
|
||||
int32 applyCount = IsAffectedBySpellmod(spellInfo, mod, spell);
|
||||
if (!applyCount)
|
||||
continue;
|
||||
|
||||
@@ -22824,7 +22823,7 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
|
||||
|
||||
for (SpellModifier* mod : spellModTypeRange(SPELLMOD_LABEL_FLAT))
|
||||
{
|
||||
uint32 applyCount = IsAffectedBySpellmod(spellInfo, mod, spell);
|
||||
int32 applyCount = IsAffectedBySpellmod(spellInfo, mod, spell);
|
||||
if (!applyCount)
|
||||
continue;
|
||||
|
||||
@@ -22838,12 +22837,12 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
|
||||
|
||||
for (SpellModifier* mod : spellModTypeRange(SPELLMOD_PCT))
|
||||
{
|
||||
uint32 applyCount = IsAffectedBySpellmod(spellInfo, mod, spell);
|
||||
int32 applyCount = IsAffectedBySpellmod(spellInfo, mod, spell);
|
||||
if (!applyCount)
|
||||
continue;
|
||||
|
||||
// skip percent mods for null basevalue (most important for spell mods with charges)
|
||||
if (base + *flat == T(0))
|
||||
if (base + *flat == 0)
|
||||
continue;
|
||||
|
||||
int32 value = static_cast<SpellModifierByClassMask*>(mod)->value;
|
||||
@@ -22853,22 +22852,22 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
|
||||
// special case (skip > 10sec spell casts for instant cast setting)
|
||||
if (op == SpellModOp::ChangeCastTime)
|
||||
{
|
||||
if (base >= T(10000) && value <= -100)
|
||||
if (base >= 10000.0 && value <= -100)
|
||||
continue;
|
||||
}
|
||||
|
||||
*pct *= std::pow(1.0f + CalculatePct(1.0f, value), applyCount);
|
||||
*pct *= std::pow(1.0f + CalculatePct(1.0f, value), float(applyCount));
|
||||
Player::ApplyModToSpell(mod, spell);
|
||||
}
|
||||
|
||||
for (SpellModifier* mod : spellModTypeRange(SPELLMOD_LABEL_PCT))
|
||||
{
|
||||
uint32 applyCount = IsAffectedBySpellmod(spellInfo, mod, spell);
|
||||
int32 applyCount = IsAffectedBySpellmod(spellInfo, mod, spell);
|
||||
if (!applyCount)
|
||||
continue;
|
||||
|
||||
// skip percent mods for null basevalue (most important for spell mods with charges)
|
||||
if (base + *flat == T(0))
|
||||
if (base + *flat == 0)
|
||||
continue;
|
||||
|
||||
float value = static_cast<SpellPctModifierByLabel*>(mod)->value.ModifierValue;
|
||||
@@ -22878,29 +22877,24 @@ void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell*
|
||||
// special case (skip > 10sec spell casts for instant cast setting)
|
||||
if (op == SpellModOp::ChangeCastTime)
|
||||
{
|
||||
if (base >= T(10000) && value <= -1.0f)
|
||||
if (base >= 10000.0 && value <= -1.0f)
|
||||
continue;
|
||||
}
|
||||
|
||||
*pct *= std::pow(value, applyCount);
|
||||
*pct *= std::pow(value, float(applyCount));
|
||||
Player::ApplyModToSpell(mod, spell);
|
||||
}
|
||||
}
|
||||
|
||||
template TC_GAME_API void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, int32 base, int32* flat, float* pct) const;
|
||||
template TC_GAME_API void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, uint32 base, int32* flat, float* pct) const;
|
||||
template TC_GAME_API void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, float base, int32* flat, float* pct) const;
|
||||
template TC_GAME_API void Player::GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, double base, int32* flat, float* pct) const;
|
||||
|
||||
template <class T>
|
||||
void Player::ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, T& basevalue, Spell* spell /*= nullptr*/) const
|
||||
{
|
||||
float totalmul = 1.0f;
|
||||
int32 totalflat = 0;
|
||||
|
||||
GetSpellModValues(spellInfo, op, spell, basevalue, &totalflat, &totalmul);
|
||||
this->GetSpellModValues(spellInfo, op, spell, basevalue, &totalflat, &totalmul);
|
||||
|
||||
basevalue = T(double(basevalue + totalflat) * totalmul);
|
||||
basevalue = T((double(basevalue) + totalflat) * totalmul);
|
||||
}
|
||||
|
||||
template TC_GAME_API void Player::ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, int32& basevalue, Spell* spell) const;
|
||||
|
||||
@@ -2026,9 +2026,8 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
PlayerSpellMap & GetSpellMap() { return m_spells; }
|
||||
|
||||
void AddSpellMod(SpellModifier* mod, bool apply);
|
||||
static uint32 IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier const* mod, Spell const* spell = nullptr);
|
||||
template <class T>
|
||||
void GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, T base, int32* flat, float* pct) const;
|
||||
static int32 IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier const* mod, Spell const* spell = nullptr);
|
||||
void GetSpellModValues(SpellInfo const* spellInfo, SpellModOp op, Spell* spell, double base, int32* flat, float* pct) const;
|
||||
template <class T>
|
||||
void ApplySpellMod(SpellInfo const* spellInfo, SpellModOp op, T& basevalue, Spell* spell = nullptr) const;
|
||||
static void ApplyModToSpell(SpellModifier* mod, Spell* spell);
|
||||
|
||||
@@ -1949,7 +1949,7 @@ bool SpellInfo::IsAffectedBySpellMods() const
|
||||
return !HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS);
|
||||
}
|
||||
|
||||
uint32 SpellInfo::IsAffectedBySpellMod(SpellModifier const* mod) const
|
||||
int32 SpellInfo::IsAffectedBySpellMod(SpellModifier const* mod) const
|
||||
{
|
||||
SpellInfo const* affectSpell = sSpellMgr->GetSpellInfo(mod->spellId, Difficulty);
|
||||
if (!affectSpell)
|
||||
|
||||
@@ -521,7 +521,7 @@ class TC_GAME_API SpellInfo
|
||||
bool IsAffected(uint32 familyName, flag128 const& familyFlags) const;
|
||||
|
||||
bool IsAffectedBySpellMods() const;
|
||||
uint32 IsAffectedBySpellMod(SpellModifier const* mod) const;
|
||||
int32 IsAffectedBySpellMod(SpellModifier const* mod) const;
|
||||
bool IsUpdatingTemporaryAuraValuesBySpellMod() const;
|
||||
|
||||
bool CanPierceImmuneAura(SpellInfo const* auraSpellInfo) const;
|
||||
|
||||
Reference in New Issue
Block a user