mirror of
https://github.com/mangosfour/server.git
synced 2025-12-20 07:37:02 +00:00
[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:
parent
4b7dffcc09
commit
5a22b8c6dd
5 changed files with 26 additions and 24 deletions
|
|
@ -81,7 +81,9 @@ class MANGOS_DLL_SPEC ViewPoint
|
|||
{
|
||||
friend class Camera;
|
||||
|
||||
std::list<Camera*> m_cameras;
|
||||
typedef std::list<Camera*> CameraList;
|
||||
|
||||
CameraList m_cameras;
|
||||
GridType * m_grid;
|
||||
|
||||
void Attach(Camera* c) { m_cameras.push_back(c); }
|
||||
|
|
@ -91,7 +93,7 @@ class MANGOS_DLL_SPEC ViewPoint
|
|||
{
|
||||
if (!m_cameras.empty())
|
||||
{
|
||||
for(std::list<Camera*>::iterator itr = m_cameras.begin(); itr != m_cameras.end();)
|
||||
for(CameraList::iterator itr = m_cameras.begin(); itr != m_cameras.end();)
|
||||
{
|
||||
Camera *c = *(itr++);
|
||||
(c->*handler)();
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -655,13 +655,13 @@ namespace MaNGOS
|
|||
{
|
||||
struct MANGOS_DLL_DECL SpellNotifierPlayer
|
||||
{
|
||||
std::list<Unit*> &i_data;
|
||||
Spell::UnitList &i_data;
|
||||
Spell &i_spell;
|
||||
const uint32& i_index;
|
||||
float i_radius;
|
||||
WorldObject* i_originalCaster;
|
||||
|
||||
SpellNotifierPlayer(Spell &spell, std::list<Unit*> &data, const uint32 &i, float radius)
|
||||
SpellNotifierPlayer(Spell &spell, Spell::UnitList &data, const uint32 &i, float radius)
|
||||
: i_data(data), i_spell(spell), i_index(i), i_radius(radius)
|
||||
{
|
||||
i_originalCaster = i_spell.GetAffectiveCasterObject();
|
||||
|
|
@ -690,7 +690,7 @@ namespace MaNGOS
|
|||
|
||||
struct MANGOS_DLL_DECL SpellNotifierCreatureAndPlayer
|
||||
{
|
||||
std::list<Unit*> *i_data;
|
||||
Spell::UnitList *i_data;
|
||||
Spell &i_spell;
|
||||
SpellNotifyPushType i_push_type;
|
||||
float i_radius;
|
||||
|
|
@ -698,7 +698,7 @@ namespace MaNGOS
|
|||
WorldObject* i_originalCaster;
|
||||
bool i_playerControlled;
|
||||
|
||||
SpellNotifierCreatureAndPlayer(Spell &spell, std::list<Unit*> &data, float radius, SpellNotifyPushType type,
|
||||
SpellNotifierCreatureAndPlayer(Spell &spell, Spell::UnitList &data, float radius, SpellNotifyPushType type,
|
||||
SpellTargets TargetType = SPELL_TARGETS_NOT_FRIENDLY, WorldObject* originalCaster = NULL)
|
||||
: i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType),
|
||||
i_originalCaster(originalCaster)
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ void AreaAura::Update(uint32 diff)
|
|||
Unit* owner = caster->GetCharmerOrOwner();
|
||||
if (!owner)
|
||||
owner = caster;
|
||||
std::list<Unit *> targets;
|
||||
Spell::UnitList targets;
|
||||
|
||||
switch(m_areaAuraType)
|
||||
{
|
||||
|
|
@ -668,7 +668,7 @@ void AreaAura::Update(uint32 diff)
|
|||
}
|
||||
}
|
||||
|
||||
for(std::list<Unit *>::iterator tIter = targets.begin(); tIter != targets.end(); tIter++)
|
||||
for(Spell::UnitList::iterator tIter = targets.begin(); tIter != targets.end(); tIter++)
|
||||
{
|
||||
// flag for seelction is need apply aura to current iteration target
|
||||
bool apply = true;
|
||||
|
|
@ -7730,7 +7730,7 @@ void Aura::PeriodicDummyTick()
|
|||
if (target->hasUnitState(UNIT_STAT_STUNNED) || target->isFeared())
|
||||
return;
|
||||
|
||||
std::list<Unit*> targets;
|
||||
Spell::UnitList targets;
|
||||
{
|
||||
// eff_radius ==0
|
||||
float radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(spell->rangeIndex));
|
||||
|
|
@ -7743,7 +7743,7 @@ void Aura::PeriodicDummyTick()
|
|||
if(targets.empty())
|
||||
return;
|
||||
|
||||
std::list<Unit*>::const_iterator itr = targets.begin();
|
||||
Spell::UnitList::const_iterator itr = targets.begin();
|
||||
std::advance(itr, rand()%targets.size());
|
||||
Unit* victim = *itr;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11367"
|
||||
#define REVISION_NR "11368"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue