aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-06-18 21:18:48 +0200
committerShauren <shauren.trinity@gmail.com>2024-06-18 21:18:48 +0200
commitc727e35d05ed6b5657a97cf576aa8f28bfd159a1 (patch)
tree19d95dff7f0ba0002c2b5b6f5af573b2fdfa877f /src
parenta7e4126472432d1c6a7775be9c98ddaafe289c1c (diff)
Fix GCC 11 build
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e89fa205ac6..1fe191d8e91 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -22332,16 +22332,24 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
if (mod->type == SPELLMOD_FLAT)
{
modData.ModifierValue = 0.0f;
- for (SpellModifier* spellMod : std::ranges::equal_range(m_spellMods, std::make_pair(mod->op, SPELLMOD_FLAT), std::ranges::less(), [](SpellModifier const* sm) { return std::make_pair(sm->op, sm->type); }))
- if (static_cast<SpellModifierByClassMask const*>(spellMod)->mask[classIndex / 32] & (1u << (classIndex % 32)))
- modData.ModifierValue += static_cast<SpellModifierByClassMask const*>(spellMod)->value;
+ auto itr = std::ranges::lower_bound(m_spellMods, std::make_pair(mod->op, SPELLMOD_FLAT), std::ranges::less(), [](SpellModifier const* sm) { return std::make_pair(sm->op, sm->type); });
+ while (itr != m_spellMods.end() && (*itr)->op == mod->op && (*itr)->type == SPELLMOD_FLAT)
+ {
+ SpellModifierByClassMask const* spellMod = static_cast<SpellModifierByClassMask const*>(*itr++);
+ if (spellMod->mask[classIndex / 32] & (1u << (classIndex % 32)))
+ modData.ModifierValue += spellMod->value;
+ }
}
else
{
modData.ModifierValue = 1.0f;
- for (SpellModifier* spellMod : std::ranges::equal_range(m_spellMods, std::make_pair(mod->op, SPELLMOD_PCT), std::ranges::less(), [](SpellModifier const* sm) { return std::make_pair(sm->op, sm->type); }))
- if (static_cast<SpellModifierByClassMask const*>(spellMod)->mask[classIndex / 32] & (1u << (classIndex % 32)))
- modData.ModifierValue *= 1.0f + CalculatePct(1.0f, static_cast<SpellModifierByClassMask const*>(spellMod)->value);
+ auto itr = std::ranges::lower_bound(m_spellMods, std::make_pair(mod->op, SPELLMOD_PCT), std::ranges::less(), [](SpellModifier const* sm) { return std::make_pair(sm->op, sm->type); });
+ while (itr != m_spellMods.end() && (*itr)->op == mod->op && (*itr)->type == SPELLMOD_PCT)
+ {
+ SpellModifierByClassMask const* spellMod = static_cast<SpellModifierByClassMask const*>(*itr++);
+ if (spellMod->mask[classIndex / 32] & (1u << (classIndex % 32)))
+ modData.ModifierValue *= 1.0f + CalculatePct(1.0f, spellMod->value);
+ }
}
modData.ClassIndex = classIndex;