diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 21 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.h | 10 |
2 files changed, 16 insertions, 15 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>(); } diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index ab932a61b07..e13add0b0e4 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -248,11 +248,11 @@ public: float ResourceCoefficient; } Scaling; - explicit SpellEffectInfo(SpellInfo const* spellInfo); + explicit SpellEffectInfo(); explicit SpellEffectInfo(SpellInfo const* spellInfo, SpellEffectEntry const& effect); - SpellEffectInfo(SpellEffectInfo const&); + SpellEffectInfo(SpellEffectInfo const&) = delete; SpellEffectInfo(SpellEffectInfo&&) noexcept; - SpellEffectInfo& operator=(SpellEffectInfo const&); + SpellEffectInfo& operator=(SpellEffectInfo const&) = delete; SpellEffectInfo& operator=(SpellEffectInfo&&) noexcept; ~SpellEffectInfo(); @@ -280,7 +280,7 @@ public: ExpectedStatType GetScalingExpectedStat() const; struct ImmunityInfo; - ImmunityInfo const* GetImmunityInfo() const { return _immunityInfo; } + ImmunityInfo const* GetImmunityInfo() const { return _immunityInfo.get(); } private: struct StaticData @@ -293,7 +293,7 @@ private: }; static std::array<StaticData, TOTAL_SPELL_EFFECTS> _data; - ImmunityInfo* _immunityInfo; + std::unique_ptr<ImmunityInfo> _immunityInfo; }; typedef std::vector<SpellXSpellVisualEntry const*> SpellVisualVector; |