aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-03-15 13:37:56 -0300
committerShauren <shauren.trinity@gmail.com>2019-08-17 20:04:14 +0200
commit13e79117d98b2ec091c4b223f24dfc0b4b0369e7 (patch)
treea028ed2cdff9119f158acd5e08e4f93ff7fdbcac
parent56ba22ea9829358a1c0f5154b8f2f80c206329e2 (diff)
Core/Auras: make AuraEffect::GetTargetList and AuraEffect::GetApplicationList accept any container
(cherrypicked from c1afabbf038ee2ebefa06871f1007d489f5d570d)
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp26
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h8
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 a4368a0278b..dac41685c72 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -582,24 +582,26 @@ AuraEffect::~AuraEffect()
delete m_spellmod;
}
-void AuraEffect::GetTargetList(std::list<Unit*> & targetList) const
+template <typename Container>
+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<AuraApplication*> & applicationList) const
+template <typename Container>
+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);
}
}
@@ -6234,3 +6236,11 @@ void AuraEffect::HandleLinkedSummon(AuraApplication const* aurApp, uint8 mode, b
}
}
}
+
+template TC_GAME_API void AuraEffect::GetTargetList(std::list<Unit*>&) const;
+template TC_GAME_API void AuraEffect::GetTargetList(std::deque<Unit*>&) const;
+template TC_GAME_API void AuraEffect::GetTargetList(std::vector<Unit*>&) const;
+
+template TC_GAME_API void AuraEffect::GetApplicationList(std::list<AuraApplication*>&) const;
+template TC_GAME_API void AuraEffect::GetApplicationList(std::deque<AuraApplication*>&) const;
+template TC_GAME_API void AuraEffect::GetApplicationList(std::vector<AuraApplication*>&) const;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index fb28e1c2daf..a9d8ea4a52c 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<Unit*> & targetList) const;
- void GetApplicationList(std::list<AuraApplication*> & applicationList) const;
+
+ template <typename Container>
+ void GetTargetList(Container& targetContainer) const;
+
+ template <typename Container>
+ void GetApplicationList(Container& applicationContainer) const;
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
uint32 GetId() const { return m_spellInfo->Id; }