diff options
| author | Shauren <shauren.trinity@gmail.com> | 2023-10-26 15:52:22 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2023-10-26 15:52:22 +0200 |
| commit | 858c393d07c5ce06e6f34948315588974701ae88 (patch) | |
| tree | 8c232264cea72479461522d8effd98dfe64173a1 /src/server/game/Spells/SpellInfo.cpp | |
| parent | 2d492c1b72d5b0a62b4605b4bce787522a821e8f (diff) | |
Core/Spells: Make SpellEffectInfo not copyable
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
| -rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 390be602cac..7be8c52f8d5 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -395,7 +395,7 @@ std::array<SpellImplicitTargetInfo::StaticData, TOTAL_SPELL_TARGETS> SpellImplic {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 152 } }; -SpellEffectInfo::SpellEffectInfo(SpellInfo const* spellInfo): _spellInfo(spellInfo), EffectIndex(EFFECT_0), Effect(SPELL_EFFECT_NONE), ApplyAuraName(AuraType(0)), ApplyAuraPeriod(0), +SpellEffectInfo::SpellEffectInfo(): _spellInfo(nullptr), EffectIndex(EFFECT_0), Effect(SPELL_EFFECT_NONE), ApplyAuraName(AuraType(0)), ApplyAuraPeriod(0), BasePoints(0), RealPointsPerLevel(0), PointsPerResource(0), Amplitude(0), ChainAmplitude(0), BonusCoefficient(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), PositionFacing(0), TargetARadiusEntry(nullptr), TargetBRadiusEntry(nullptr), ChainTargets(0), ItemType(0), TriggerSpell(0), @@ -442,15 +442,10 @@ SpellEffectInfo::SpellEffectInfo(SpellInfo const* spellInfo, SpellEffectEntry co _immunityInfo = nullptr; } -SpellEffectInfo::SpellEffectInfo(SpellEffectInfo const&) = default; SpellEffectInfo::SpellEffectInfo(SpellEffectInfo&&) noexcept = default; -SpellEffectInfo& SpellEffectInfo::operator=(SpellEffectInfo const&) = default; SpellEffectInfo& SpellEffectInfo::operator=(SpellEffectInfo&&) noexcept = default; -SpellEffectInfo::~SpellEffectInfo() -{ - delete _immunityInfo; -} +SpellEffectInfo::~SpellEffectInfo() = default; bool SpellEffectInfo::IsEffect() const { @@ -1165,12 +1160,15 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, S if (!spellEffect) continue; - Trinity::Containers::EnsureWritableVectorIndex(_effects, spellEffect->EffectIndex, SpellEffectInfo(this)) = SpellEffectInfo(this, *spellEffect); + Trinity::Containers::EnsureWritableVectorIndex(_effects, spellEffect->EffectIndex) = SpellEffectInfo(this, *spellEffect); } // Correct EffectIndex for blank effects for (size_t i = 0; i < _effects.size(); ++i) + { + _effects[i]._spellInfo = this; _effects[i].EffectIndex = SpellEffIndex(i); + } _effects.shrink_to_fit(); @@ -1358,11 +1356,14 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, s _effects.reserve(32); for (SpellEffectEntry const& spellEffect : effects) - Trinity::Containers::EnsureWritableVectorIndex(_effects, spellEffect.EffectIndex, SpellEffectInfo(this)) = SpellEffectInfo(this, spellEffect); + Trinity::Containers::EnsureWritableVectorIndex(_effects, spellEffect.EffectIndex) = SpellEffectInfo(this, spellEffect); // Correct EffectIndex for blank effects for (size_t i = 0; i < _effects.size(); ++i) + { + _effects[i]._spellInfo = this; _effects[i].EffectIndex = SpellEffIndex(i); + } _effects.shrink_to_fit(); } @@ -3558,7 +3559,7 @@ void SpellInfo::_LoadImmunityInfo() || !immuneInfo.AuraTypeImmune.empty() || !immuneInfo.SpellEffectImmune.empty()) { - effect._immunityInfo = workBuffer.release(); + effect._immunityInfo = std::move(workBuffer); workBuffer = std::make_unique<SpellEffectInfo::ImmunityInfo>(); } |
