From c1afabbf038ee2ebefa06871f1007d489f5d570d Mon Sep 17 00:00:00 2001 From: ariel- Date: Wed, 15 Mar 2017 13:37:56 -0300 Subject: Core/Auras: make AuraEffect::GetTargetList and AuraEffect::GetApplicationList accept any container --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 26 ++++++++++++++++------- src/server/game/Spells/Auras/SpellAuraEffects.h | 8 +++++-- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index c83365c7ae1..8aae3682d74 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -395,24 +395,26 @@ AuraEffect::~AuraEffect() delete m_spellmod; } -void AuraEffect::GetTargetList(std::list & targetList) const +template +void AuraEffect::GetTargetList(Container& targetContainer) const { - Aura::ApplicationMap const & targetMap = GetBase()->GetApplicationMap(); + Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap(); // remove all targets which were not added to new list - they no longer deserve area aura - for (Aura::ApplicationMap::const_iterator appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter) + for (auto appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter) { if (appIter->second->HasEffect(GetEffIndex())) - targetList.push_back(appIter->second->GetTarget()); + targetContainer.push_back(appIter->second->GetTarget()); } } -void AuraEffect::GetApplicationList(std::list & applicationList) const +template +void AuraEffect::GetApplicationList(Container& applicationContainer) const { - Aura::ApplicationMap const & targetMap = GetBase()->GetApplicationMap(); - for (Aura::ApplicationMap::const_iterator appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter) + Aura::ApplicationMap const& targetMap = GetBase()->GetApplicationMap(); + for (auto appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter) { if (appIter->second->HasEffect(GetEffIndex())) - applicationList.push_back(appIter->second); + applicationContainer.push_back(appIter->second); } } @@ -6248,3 +6250,11 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); target->CastCustomSpell(target, triggerSpellId, &value, NULL, NULL, true, NULL, this, GetCasterGUID()); } + +template TC_GAME_API void AuraEffect::GetTargetList(std::list&) const; +template TC_GAME_API void AuraEffect::GetTargetList(std::deque&) const; +template TC_GAME_API void AuraEffect::GetTargetList(std::vector&) const; + +template TC_GAME_API void AuraEffect::GetApplicationList(std::list&) const; +template TC_GAME_API void AuraEffect::GetApplicationList(std::deque&) const; +template TC_GAME_API void AuraEffect::GetApplicationList(std::vector&) const; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 74b1ae80d71..3609de3a090 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -39,8 +39,12 @@ class TC_GAME_API AuraEffect Unit* GetCaster() const { return GetBase()->GetCaster(); } ObjectGuid GetCasterGUID() const { return GetBase()->GetCasterGUID(); } Aura* GetBase() const { return m_base; } - void GetTargetList(std::list & targetList) const; - void GetApplicationList(std::list & applicationList) const; + + template + void GetTargetList(Container& targetContainer) const; + + template + void GetApplicationList(Container& applicationContainer) const; SpellInfo const* GetSpellInfo() const { return m_spellInfo; } uint32 GetId() const { return m_spellInfo->Id; } -- cgit v1.2.3