[11368] small code refactoring: use container typedefs instead of direct container declarations to simplify code.

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
Ambal 2011-04-16 13:42:28 +03:00
parent 4b7dffcc09
commit 5a22b8c6dd
5 changed files with 26 additions and 24 deletions

View file

@ -466,7 +466,7 @@ void Spell::FillTargetMap()
if(IsAreaAuraEffect(m_spellInfo->Effect[i]))
AddUnitTarget(m_caster, SpellEffectIndex(i));
std::list<Unit*> tmpUnitMap;
UnitList tmpUnitMap;
// TargetA/TargetB dependent from each other, we not switch to full support this dependences
// but need it support in some know cases
@ -646,7 +646,7 @@ void Spell::FillTargetMap()
if(m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player *me = (Player*)m_caster;
for (std::list<Unit*>::const_iterator itr = tmpUnitMap.begin(); itr != tmpUnitMap.end(); ++itr)
for (UnitList::const_iterator itr = tmpUnitMap.begin(); itr != tmpUnitMap.end(); ++itr)
{
Unit *owner = (*itr)->GetOwner();
Unit *u = owner ? owner : (*itr);
@ -659,7 +659,7 @@ void Spell::FillTargetMap()
}
}
for (std::list<Unit*>::iterator itr = tmpUnitMap.begin(); itr != tmpUnitMap.end();)
for (UnitList::iterator itr = tmpUnitMap.begin(); itr != tmpUnitMap.end();)
{
if (!CheckTarget (*itr, SpellEffectIndex(i)))
{
@ -670,7 +670,7 @@ void Spell::FillTargetMap()
++itr;
}
for(std::list<Unit*>::const_iterator iunit = tmpUnitMap.begin(); iunit != tmpUnitMap.end(); ++iunit)
for(UnitList::const_iterator iunit = tmpUnitMap.begin(); iunit != tmpUnitMap.end(); ++iunit)
AddUnitTarget((*iunit), SpellEffectIndex(i));
}
}
@ -1669,7 +1669,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
unMaxTargets = EffectChainTarget;
float max_range = radius + unMaxTargets * CHAIN_SPELL_JUMP_RADIUS;
std::list<Unit *> tempTargetUnitMap;
UnitList tempTargetUnitMap;
{
MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(m_caster, max_range);
@ -1684,7 +1684,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
//Now to get us a random target that's in the initial range of the spell
uint32 t = 0;
std::list<Unit*>::iterator itr = tempTargetUnitMap.begin();
UnitList::iterator itr = tempTargetUnitMap.begin();
while(itr!= tempTargetUnitMap.end() && (*itr)->IsWithinDist(m_caster, radius))
++t, ++itr;
@ -1702,7 +1702,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
t = unMaxTargets - 1;
Unit *prev = pUnitTarget;
std::list<Unit*>::iterator next = tempTargetUnitMap.begin();
UnitList::iterator next = tempTargetUnitMap.begin();
while(t && next != tempTargetUnitMap.end())
{
@ -1730,7 +1730,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
m_targets.m_targetMask = 0;
unMaxTargets = EffectChainTarget;
float max_range = radius + unMaxTargets * CHAIN_SPELL_JUMP_RADIUS;
std::list<Unit*> tempTargetUnitMap;
UnitList tempTargetUnitMap;
{
MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(m_caster, max_range);
MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(tempTargetUnitMap, u_check);
@ -1744,7 +1744,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
//Now to get us a random target that's in the initial range of the spell
uint32 t = 0;
std::list<Unit*>::iterator itr = tempTargetUnitMap.begin();
UnitList::iterator itr = tempTargetUnitMap.begin();
while(itr != tempTargetUnitMap.end() && (*itr)->IsWithinDist(m_caster, radius))
++t, ++itr;
@ -1762,7 +1762,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
t = unMaxTargets - 1;
Unit *prev = pUnitTarget;
std::list<Unit*>::iterator next = tempTargetUnitMap.begin();
UnitList::iterator next = tempTargetUnitMap.begin();
while(t && next != tempTargetUnitMap.end())
{
@ -1816,7 +1816,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
//FIXME: This very like horrible hack and wrong for most spells
max_range = radius + unMaxTargets * CHAIN_SPELL_JUMP_RADIUS;
std::list<Unit *> tempTargetUnitMap;
UnitList tempTargetUnitMap;
{
MaNGOS::AnyAoEVisibleTargetUnitInObjectRangeCheck u_check(pUnitTarget, originalCaster, max_range);
MaNGOS::UnitListSearcher<MaNGOS::AnyAoEVisibleTargetUnitInObjectRangeCheck> searcher(tempTargetUnitMap, u_check);
@ -1833,7 +1833,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
targetUnitMap.push_back(pUnitTarget);
uint32 t = unMaxTargets - 1;
Unit *prev = pUnitTarget;
std::list<Unit*>::iterator next = tempTargetUnitMap.begin();
UnitList::iterator next = tempTargetUnitMap.begin();
while (t && next != tempTargetUnitMap.end())
{
@ -2361,7 +2361,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
targetUnitMap.push_back(pUnitTarget);
uint32 t = unMaxTargets - 1;
Unit *prev = pUnitTarget;
std::list<Unit*>::iterator next = tempTargetUnitMap.begin();
UnitList::iterator next = tempTargetUnitMap.begin();
while(t && next != tempTargetUnitMap.end())
{