diff options
| author | Shauren <shauren.trinity@gmail.com> | 2021-09-04 14:21:02 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-09-04 14:21:02 +0200 |
| commit | 325bdc0ab0707895abb1effa7044c3f168513344 (patch) | |
| tree | f52f46e6992d696aeb1260f0fff67f1b4c8ce990 /src/server/game | |
| parent | 0e12e23f7784b4a80d3515cb094342cb677e35b2 (diff) | |
Core/Spells: Remove remaining direct accesses to SpellInfo::Effects
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 8 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellInfo.h | 10 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellScript.cpp | 19 |
3 files changed, 20 insertions, 17 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index abf92924757..fd9479d68b7 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -841,7 +841,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) AreaGroupId = spellEntry->RequiredAreasID; SchoolMask = spellEntry->SchoolMask; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - Effects[i] = SpellEffectInfo(spellEntry, this, i); + _effects[i] = SpellEffectInfo(spellEntry, this, i); ChainEntry = nullptr; ExplicitTargetMask = 0; @@ -3898,9 +3898,9 @@ void SpellInfo::_UnloadImplicitTargetConditionLists() if (!cur) continue; - for (size_t j = effect.EffectIndex; j < Effects.size(); ++j) - if (Effects[j].ImplicitTargetConditions == cur) - Effects[j].ImplicitTargetConditions = nullptr; + for (size_t j = effect.EffectIndex; j < GetEffects().size(); ++j) + if (GetEffect(SpellEffIndex(j)).ImplicitTargetConditions == cur) + _GetEffect(SpellEffIndex(j)).ImplicitTargetConditions = nullptr; delete cur; } diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 3d662c445e2..0ad1810853c 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -399,7 +399,7 @@ class TC_GAME_API SpellInfo uint32 PreventionType; int32 AreaGroupId; uint32 SchoolMask; - std::array<SpellEffectInfo, MAX_SPELL_EFFECTS> Effects; + std::array<SpellEffectInfo, MAX_SPELL_EFFECTS> _effects; uint32 ExplicitTargetMask; SpellChainNode const* ChainEntry; @@ -520,8 +520,8 @@ class TC_GAME_API SpellInfo bool IsDifferentRankOf(SpellInfo const* spellInfo) const; bool IsHighRankOf(SpellInfo const* spellInfo) const; - std::array<SpellEffectInfo, MAX_SPELL_EFFECTS> const& GetEffects() const { return Effects; } - SpellEffectInfo const& GetEffect(SpellEffIndex index) const { ASSERT(index < Effects.size()); return Effects[index]; } + std::array<SpellEffectInfo, MAX_SPELL_EFFECTS> const& GetEffects() const { return _effects; } + SpellEffectInfo const& GetEffect(SpellEffIndex index) const { ASSERT(index < _effects.size()); return _effects[index]; } // spell diminishing returns DiminishingGroup GetDiminishingReturnsGroupForSpell(bool triggered) const; @@ -547,8 +547,8 @@ class TC_GAME_API SpellInfo void _LoadSpellDiminishInfo(); void _LoadImmunityInfo(); - std::array<SpellEffectInfo, MAX_SPELL_EFFECTS>& _GetEffects() { return Effects; } - SpellEffectInfo& _GetEffect(SpellEffIndex index) { ASSERT(index < Effects.size()); return Effects[index]; } + std::array<SpellEffectInfo, MAX_SPELL_EFFECTS>& _GetEffects() { return _effects; } + SpellEffectInfo& _GetEffect(SpellEffIndex index) { ASSERT(index < _effects.size()); return _effects[index]; } // unloading helpers void _UnloadImplicitTargetConditionLists(); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 13d21323ce3..a822e3a0147 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -131,11 +131,12 @@ std::string _SpellScript::EffectHook::EffIndexToString() bool _SpellScript::EffectNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex) { - if (!spellEntry->Effects[effIndex].Effect && !effName) + SpellEffectInfo const& spellEffectInfo = spellEntry->GetEffect(SpellEffIndex(effIndex)); + if (!spellEffectInfo.Effect && !effName) return true; - if (!spellEntry->Effects[effIndex].Effect) + if (!spellEffectInfo.Effect) return false; - return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].Effect == effName); + return (effName == SPELL_EFFECT_ANY) || (spellEffectInfo.Effect == effName); } std::string _SpellScript::EffectNameCheck::ToString() @@ -153,11 +154,12 @@ std::string _SpellScript::EffectNameCheck::ToString() bool _SpellScript::EffectAuraNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex) { - if (!spellEntry->Effects[effIndex].ApplyAuraName && !effAurName) + SpellEffectInfo const& spellEffectInfo = spellEntry->GetEffect(SpellEffIndex(effIndex)); + if (!spellEffectInfo.ApplyAuraName && !effAurName) return true; - if (!spellEntry->Effects[effIndex].ApplyAuraName) + if (!spellEffectInfo.ApplyAuraName) return false; - return (effAurName == SPELL_AURA_ANY) || (spellEntry->Effects[effIndex].ApplyAuraName == effAurName); + return (effAurName == SPELL_AURA_ANY) || (spellEffectInfo.ApplyAuraName == effAurName); } std::string _SpellScript::EffectAuraNameCheck::ToString() @@ -259,8 +261,9 @@ bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 eff if (!targetType) return false; - if (spellEntry->Effects[effIndexToCheck].TargetA.GetTarget() != targetType && - spellEntry->Effects[effIndexToCheck].TargetB.GetTarget() != targetType) + SpellEffectInfo const& spellEffectInfo = spellEntry->GetEffect(SpellEffIndex(effIndexToCheck)); + if (spellEffectInfo.TargetA.GetTarget() != targetType && + spellEffectInfo.TargetB.GetTarget() != targetType) return false; SpellImplicitTargetInfo targetInfo(targetType); |
