Core/Spells: Initialize EffectIndex of empty effects to their proper values instead of always being 0

Closes #27261
This commit is contained in:
Shauren
2021-12-04 23:20:55 +01:00
parent 6e5f35a14c
commit 759d2fdd86

View File

@@ -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();
}