aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-12-04 23:20:55 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-04 23:20:55 +0100
commit759d2fdd862eb86d022e79adcd3a90374fef58e4 (patch)
treefd28f91afe03a25d94a64206740be8081f80e825 /src
parent6e5f35a14ce0b894d95434f27fab8f7d0ba6dedc (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.cpp8
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();
}