From 759d2fdd862eb86d022e79adcd3a90374fef58e4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 4 Dec 2021 23:20:55 +0100 Subject: Core/Spells: Initialize EffectIndex of empty effects to their proper values instead of always being 0 Closes #27261 --- src/server/game/Spells/SpellInfo.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 574c9f11a19..e80de7b966f 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1086,6 +1086,10 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, S Trinity::Containers::EnsureWritableVectorIndex(_effects, spellEffect->EffectIndex, SpellEffectInfo(this)) = SpellEffectInfo(this, *spellEffect); } + // Correct EffectIndex for blank effects + for (size_t i = 0; i < _effects.size(); ++i) + _effects[i].EffectIndex = SpellEffIndex(i); + _effects.shrink_to_fit(); SpellName = &spellName->Name; @@ -1269,6 +1273,10 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, s for (SpellEffectEntry const& spellEffect : effects) Trinity::Containers::EnsureWritableVectorIndex(_effects, spellEffect.EffectIndex, SpellEffectInfo(this)) = SpellEffectInfo(this, spellEffect); + // Correct EffectIndex for blank effects + for (size_t i = 0; i < _effects.size(); ++i) + _effects[i].EffectIndex = SpellEffIndex(i); + _effects.shrink_to_fit(); } -- cgit v1.2.3