mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: Make SpellEffectInfo not copyable
This commit is contained in:
@@ -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>();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user