From 32dcb3bf63487a8ac703159a2fdc96d3aaad9a6e Mon Sep 17 00:00:00 2001 From: niaro-kitty <60557949+niaro-kitty@users.noreply.github.com> Date: Wed, 19 Feb 2020 09:55:18 +0300 Subject: [PATCH] feat(Core/Spell): Header include optimization for files: SpellAura.h SpellAuraEffects.h (#2632) --- src/server/game/Combat/ThreatManager.cpp | 1 + .../game/Spells/Auras/SpellAuraEffects.cpp | 25 +++++++++++++++++++ .../game/Spells/Auras/SpellAuraEffects.h | 11 ++++---- src/server/game/Spells/Auras/SpellAuras.cpp | 13 ++++++++++ src/server/game/Spells/Auras/SpellAuras.h | 8 ++---- 5 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 2dcb349a8..1fcb4eb39 100644 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -14,6 +14,7 @@ #include "UnitEvents.h" #include "SpellAuras.h" #include "SpellMgr.h" +#include "SpellInfo.h" //============================================================== //================= ThreatCalcHelper =========================== diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 06dbe1cb2..0e4326502 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -416,6 +416,26 @@ void AuraEffect::GetApplicationList(std::list & applicationLis } } +uint32 AuraEffect::GetId() const +{ + return m_spellInfo->Id; +} + +int32 AuraEffect::GetMiscValueB() const +{ + return m_spellInfo->Effects[m_effIndex].MiscValueB; +} + +int32 AuraEffect::GetMiscValue() const +{ + return m_spellInfo->Effects[m_effIndex].MiscValue; +} + +AuraType AuraEffect::GetAuraType() const +{ + return (AuraType)m_spellInfo->Effects[m_effIndex].ApplyAuraName; +} + int32 AuraEffect::CalculateAmount(Unit* caster) { int32 amount; @@ -1048,6 +1068,11 @@ bool AuraEffect::IsAffectedOnSpell(SpellInfo const* spell) const return false; } +bool AuraEffect::HasSpellClassMask() const +{ + return m_spellInfo->Effects[m_effIndex].SpellClassMask; +} + void AuraEffect::SendTickImmune(Unit* target, Unit* caster) const { if (caster) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index cc8a8725a..04d696dd9 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -14,7 +14,6 @@ class SpellInfo; #include "SpellAuras.h" #include "Spell.h" -#include "SpellInfo.h" typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uint8 mode, bool apply) const; @@ -35,14 +34,14 @@ class AuraEffect SpellModifier* GetSpellModifier() const { return m_spellmod; } SpellInfo const* GetSpellInfo() const { return m_spellInfo; } - uint32 GetId() const { return m_spellInfo->Id; } + uint32 GetId() const; uint32 GetEffIndex() const { return m_effIndex; } int32 GetBaseAmount() const { return m_baseAmount; } int32 GetAmplitude() const { return m_amplitude; } - int32 GetMiscValueB() const { return m_spellInfo->Effects[m_effIndex].MiscValueB; } - int32 GetMiscValue() const { return m_spellInfo->Effects[m_effIndex].MiscValue; } - AuraType GetAuraType() const { return (AuraType)m_spellInfo->Effects[m_effIndex].ApplyAuraName; } + int32 GetMiscValueB() const; + int32 GetMiscValue() const; + AuraType GetAuraType() const; int32 GetAmount() const { return m_isAuraEnabled ? m_amount : 0; } int32 GetForcedAmount() const { return m_amount; } void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;} @@ -73,7 +72,7 @@ class AuraEffect bool IsPeriodic() const { return m_isPeriodic; } void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; } bool IsAffectedOnSpell(SpellInfo const* spell) const; - bool HasSpellClassMask() const { return m_spellInfo->Effects[m_effIndex].SpellClassMask; } + bool HasSpellClassMask() const; void SendTickImmune(Unit* target, Unit* caster) const; void PeriodicTick(AuraApplication * aurApp, Unit* caster) const; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index e4cdcf955..4ef2411f6 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -25,6 +25,9 @@ #include "Vehicle.h" #include "ArenaSpectator.h" +// update aura target map every 500 ms instead of every update - reduce amount of grid searcher calls +static constexpr int32 UPDATE_TARGET_MAP_INTERVAL = 500; + AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask): _target(target), _base(aura), _removeMode(AURA_REMOVE_NONE), _slot(MAX_AURAS), _flags(AFLAG_NONE), _effectsToApply(effMask), _needClientUpdate(false), _disableMask(0) @@ -450,6 +453,11 @@ Aura::~Aura() _DeleteRemovedApplications(); } +uint32 Aura::GetId() const +{ + return GetSpellInfo()->Id; +} + Unit* Aura::GetCaster() const { if (GetOwner()->GetGUID() == GetCasterGUID()) @@ -1008,6 +1016,11 @@ bool Aura::IsDeathPersistent() const return GetSpellInfo()->IsDeathPersistent(); } +bool Aura::IsRemovedOnShapeLost(Unit *target) const +{ + return (GetCasterGUID() == target->GetGUID() && m_spellInfo->Stances && !m_spellInfo->HasAttribute(SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !m_spellInfo->HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT)); +} + bool Aura::CanBeSaved() const { if (IsPassive() || (GetSpellInfo()->HasAttribute(SPELL_ATTR0_HIDDEN_CLIENTSIDE) && GetSpellInfo()->Stances)) diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index ed3cfeae0..1de1ad7d2 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -8,7 +8,6 @@ #define ACORE_SPELLAURAS_H #include "SpellAuraDefines.h" -#include "SpellInfo.h" #include "Unit.h" class Unit; @@ -24,9 +23,6 @@ class DynamicObject; class AuraScript; class ProcInfo; -// update aura target map every 500 ms instead of every update - reduce amount of grid searcher calls -#define UPDATE_TARGET_MAP_INTERVAL 500 - class AuraApplication { friend void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask); @@ -93,7 +89,7 @@ class Aura virtual ~Aura(); SpellInfo const* GetSpellInfo() const { return m_spellInfo; } - uint32 GetId() const{ return GetSpellInfo()->Id; } + uint32 GetId() const; uint64 GetCastItemGUID() const { return m_castItemGuid; } uint32 GetCastItemEntry() const { return m_castItemEntry; } @@ -151,7 +147,7 @@ class Aura bool IsArea() const; bool IsPassive() const; bool IsDeathPersistent() const; - bool IsRemovedOnShapeLost(Unit* target) const { return (GetCasterGUID() == target->GetGUID() && m_spellInfo->Stances && !m_spellInfo->HasAttribute(SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !m_spellInfo->HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT)); } + bool IsRemovedOnShapeLost(Unit* target) const; bool CanBeSaved() const; bool IsRemoved() const { return m_isRemoved; } bool CanBeSentToClient() const;