aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-09-05 23:04:33 +0200
committerShauren <shauren.trinity@gmail.com>2021-09-05 23:04:33 +0200
commitadd2e6d212b356347241bfd1b52b37a447df74ce (patch)
tree70174956afe7d4db9ed4c6c1dc8963fddc4e1f1c /src
parent60ff73eeba93c7f97abff0eeb504cb4b5ff8a6cd (diff)
Core/Spells: Avoid static analysis false positive
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Spell.cpp27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 263d597ef2c..7fa43bfb3eb 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4402,25 +4402,14 @@ void Spell::SendSpellGo()
{
castData.RemainingRunes = boost::in_place();
- //TODO: There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature
- //The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster
- if (Player* player = m_caster->ToPlayer())
- {
- castData.RemainingRunes->Start = m_runesState; // runes state before
- castData.RemainingRunes->Count = player->GetRunesState(); // runes state after
- for (uint8 i = 0; i < player->GetMaxPower(POWER_RUNES); ++i)
- {
- // float casts ensure the division is performed on floats as we need float result
- float baseCd = float(player->GetRuneBaseCooldown());
- castData.RemainingRunes->Cooldowns.push_back((baseCd - float(player->GetRuneCooldown(i))) / baseCd * 255); // rune cooldown passed
- }
- }
- else
- {
- castData.RemainingRunes->Start = 0;
- castData.RemainingRunes->Count = 0;
- for (uint8 i = 0; i < player->GetMaxPower(POWER_RUNES); ++i)
- castData.RemainingRunes->Cooldowns.push_back(0);
+ Player* player = ASSERT_NOTNULL(m_caster->ToPlayer());
+ castData.RemainingRunes->Start = m_runesState; // runes state before
+ castData.RemainingRunes->Count = player->GetRunesState(); // runes state after
+ for (uint8 i = 0; i < player->GetMaxPower(POWER_RUNES); ++i)
+ {
+ // float casts ensure the division is performed on floats as we need float result
+ float baseCd = float(player->GetRuneBaseCooldown());
+ castData.RemainingRunes->Cooldowns.push_back((baseCd - float(player->GetRuneCooldown(i))) / baseCd * 255); // rune cooldown passed
}
}