diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-12-04 23:20:55 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-04 23:20:55 +0100 |
commit | 759d2fdd862eb86d022e79adcd3a90374fef58e4 (patch) | |
tree | fd28f91afe03a25d94a64206740be8081f80e825 /src | |
parent | 6e5f35a14ce0b894d95434f27fab8f7d0ba6dedc (diff) |
Core/Spells: Initialize EffectIndex of empty effects to their proper values instead of always being 0
Closes #27261
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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(); } |