[11293] Cleanups in spell target lists

This commit is contained in:
zergtmn 2011-03-28 01:14:36 +06:00
parent 37fd225a89
commit ee5b59b7e0
4 changed files with 76 additions and 71 deletions

View file

@ -802,7 +802,7 @@ void Spell::CleanupTargetList()
void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex) void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex)
{ {
if( m_spellInfo->Effect[effIndex] == 0 ) if (m_spellInfo->Effect[effIndex] == 0)
return; return;
// Check for effect immune skip if immuned // Check for effect immune skip if immuned
@ -811,7 +811,7 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex)
ObjectGuid targetGUID = pVictim->GetObjectGuid(); ObjectGuid targetGUID = pVictim->GetObjectGuid();
// Lookup target in already in list // Lookup target in already in list
for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if (targetGUID == ihit->targetGUID) // Found in list if (targetGUID == ihit->targetGUID) // Found in list
{ {
@ -879,13 +879,13 @@ void Spell::AddUnitTarget(uint64 unitGUID, SpellEffectIndex effIndex)
void Spell::AddGOTarget(GameObject* pVictim, SpellEffectIndex effIndex) void Spell::AddGOTarget(GameObject* pVictim, SpellEffectIndex effIndex)
{ {
if( m_spellInfo->Effect[effIndex] == 0 ) if (m_spellInfo->Effect[effIndex] == 0)
return; return;
ObjectGuid targetGUID = pVictim->GetObjectGuid(); ObjectGuid targetGUID = pVictim->GetObjectGuid();
// Lookup target in already in list // Lookup target in already in list
for(std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) for(GOTargetList::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
{ {
if (targetGUID == ihit->targetGUID) // Found in list if (targetGUID == ihit->targetGUID) // Found in list
{ {
@ -931,11 +931,11 @@ void Spell::AddGOTarget(uint64 goGUID, SpellEffectIndex effIndex)
void Spell::AddItemTarget(Item* pitem, SpellEffectIndex effIndex) void Spell::AddItemTarget(Item* pitem, SpellEffectIndex effIndex)
{ {
if( m_spellInfo->Effect[effIndex] == 0 ) if (m_spellInfo->Effect[effIndex] == 0)
return; return;
// Lookup target in already in list // Lookup target in already in list
for(std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) for(ItemTargetList::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
{ {
if (pitem == ihit->item) // Found in list if (pitem == ihit->item) // Found in list
{ {
@ -1416,9 +1416,9 @@ bool Spell::IsAliveUnitPresentInTargetList()
uint8 needAliveTargetMask = m_needAliveTargetMask; uint8 needAliveTargetMask = m_needAliveTargetMask;
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) ) if (ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask))
{ {
Unit *unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); Unit *unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
@ -2839,12 +2839,12 @@ void Spell::cancel()
case SPELL_STATE_CASTING: case SPELL_STATE_CASTING:
{ {
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if( ihit->missCondition == SPELL_MISS_NONE ) if (ihit->missCondition == SPELL_MISS_NONE)
{ {
Unit* unit = m_caster->GetObjectGuid() == (*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); Unit* unit = m_caster->GetObjectGuid() == (*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if( unit && unit->isAlive() ) if (unit && unit->isAlive())
unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
} }
} }
@ -3103,7 +3103,7 @@ void Spell::cast(bool skipCheck)
TakeCastItem(); TakeCastItem();
// fill initial spell damage from caster for delayed casted spells // fill initial spell damage from caster for delayed casted spells
for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
HandleDelayedSpellLaunch(&(*ihit)); HandleDelayedSpellLaunch(&(*ihit));
// Okay, maps created, now prepare flags // Okay, maps created, now prepare flags
@ -3140,10 +3140,10 @@ void Spell::handle_immediate()
// process immediate effects (items, ground, etc.) also initialize some variables // process immediate effects (items, ground, etc.) also initialize some variables
_handle_immediate_phase(); _handle_immediate_phase();
for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
for(std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) for(GOTargetList::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
// spell is finished, perform some last features of the spell here // spell is finished, perform some last features of the spell here
@ -3167,25 +3167,25 @@ uint64 Spell::handle_delayed(uint64 t_offset)
} }
// now recheck units targeting correctness (need before any effects apply to prevent adding immunity at first effect not allow apply second spell effect and similar cases) // now recheck units targeting correctness (need before any effects apply to prevent adding immunity at first effect not allow apply second spell effect and similar cases)
for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if (ihit->processed == false) if (!ihit->processed)
{ {
if ( ihit->timeDelay <= t_offset ) if (ihit->timeDelay <= t_offset)
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
else if( next_time == 0 || ihit->timeDelay < next_time ) else if (next_time == 0 || ihit->timeDelay < next_time)
next_time = ihit->timeDelay; next_time = ihit->timeDelay;
} }
} }
// now recheck gameobject targeting correctness // now recheck gameobject targeting correctness
for(std::list<GOTargetInfo>::iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit) for(GOTargetList::iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit)
{ {
if (ighit->processed == false) if (!ighit->processed)
{ {
if ( ighit->timeDelay <= t_offset ) if (ighit->timeDelay <= t_offset)
DoAllEffectOnTarget(&(*ighit)); DoAllEffectOnTarget(&(*ighit));
else if( next_time == 0 || ighit->timeDelay < next_time ) else if (next_time == 0 || ighit->timeDelay < next_time)
next_time = ighit->timeDelay; next_time = ighit->timeDelay;
} }
} }
@ -3235,7 +3235,7 @@ void Spell::_handle_immediate_phase()
m_diminishGroup = DIMINISHING_NONE; m_diminishGroup = DIMINISHING_NONE;
// process items // process items
for(std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) for(ItemTargetList::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
DoAllEffectOnTarget(&(*ihit)); DoAllEffectOnTarget(&(*ihit));
// process ground // process ground
@ -3358,24 +3358,24 @@ void Spell::update(uint32 difftime)
{ {
if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() )
{ {
for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
TargetInfo* target = &*ihit; TargetInfo const& target = *ihit;
if(!target->targetGUID.IsCreature()) if (!target.targetGUID.IsCreature())
continue; continue;
Unit* unit = m_caster->GetObjectGuid() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID); Unit* unit = m_caster->GetObjectGuid() == target.targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target.targetGUID);
if (unit == NULL) if (unit == NULL)
continue; continue;
p->RewardPlayerAndGroupAtCast(unit, m_spellInfo->Id); p->RewardPlayerAndGroupAtCast(unit, m_spellInfo->Id);
} }
for(std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) for(GOTargetList::const_iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
{ {
GOTargetInfo* target = &*ihit; GOTargetInfo const& target = *ihit;
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID); GameObject* go = m_caster->GetMap()->GetGameObject(target.targetGUID);
if(!go) if(!go)
continue; continue;
@ -3417,9 +3417,9 @@ void Spell::finish(bool ok)
{ {
if (!(*i)->isAffectedOnSpell(m_spellInfo)) if (!(*i)->isAffectedOnSpell(m_spellInfo))
continue; continue;
for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if( ihit->missCondition == SPELL_MISS_NONE ) if (ihit->missCondition == SPELL_MISS_NONE)
{ {
// check m_caster->GetGUID() let load auras at login and speedup most often case // check m_caster->GetGUID() let load auras at login and speedup most often case
Unit *unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); Unit *unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
@ -3462,7 +3462,7 @@ void Spell::finish(bool ok)
bool needDrop = true; bool needDrop = true;
if (!IsPositiveSpell(m_spellInfo->Id)) if (!IsPositiveSpell(m_spellInfo->Id))
{ {
for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if (ihit->missCondition != SPELL_MISS_NONE && ihit->targetGUID != m_caster->GetObjectGuid()) if (ihit->missCondition != SPELL_MISS_NONE && ihit->targetGUID != m_caster->GetObjectGuid())
{ {
@ -3691,7 +3691,7 @@ void Spell::SendSpellGo()
m_caster->SendMessageToSet(&data, true); m_caster->SendMessageToSet(&data, true);
} }
void Spell::WriteAmmoToPacket( WorldPacket * data ) void Spell::WriteAmmoToPacket(WorldPacket* data)
{ {
uint32 ammoInventoryType = 0; uint32 ammoInventoryType = 0;
uint32 ammoDisplayID = 0; uint32 ammoDisplayID = 0;
@ -3763,47 +3763,47 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
*data << uint32(ammoInventoryType); *data << uint32(ammoInventoryType);
} }
void Spell::WriteSpellGoTargets( WorldPacket * data ) void Spell::WriteSpellGoTargets(WorldPacket* data)
{ {
size_t count_pos = data->wpos();
*data << uint8(0); // placeholder
// This function also fill data for channeled spells: // This function also fill data for channeled spells:
// m_needAliveTargetMask req for stop channeling if one target die // m_needAliveTargetMask req for stop channeling if one target die
uint32 hit = m_UniqueGOTargetInfo.size(); // Always hits on GO uint32 hit = m_UniqueGOTargetInfo.size(); // Always hits on GO
uint32 miss = 0; uint32 miss = 0;
for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if ((*ihit).effectMask == 0) // No effect apply - all immuned add state if (ihit->effectMask == 0) // No effect apply - all immuned add state
{ {
// possibly SPELL_MISS_IMMUNE2 for this?? // possibly SPELL_MISS_IMMUNE2 for this??
ihit->missCondition = SPELL_MISS_IMMUNE2; ihit->missCondition = SPELL_MISS_IMMUNE2;
++miss; ++miss;
} }
else if ((*ihit).missCondition == SPELL_MISS_NONE) else if (ihit->missCondition == SPELL_MISS_NONE) // Add only hits
{
++hit; ++hit;
*data << ihit->targetGUID;
m_needAliveTargetMask |= ihit->effectMask;
}
else else
++miss; ++miss;
} }
*data << (uint8)hit; for(GOTargetList::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit)
for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits
{
*data << ihit->targetGUID;
m_needAliveTargetMask |=ihit->effectMask;
}
}
for(std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit)
*data << ighit->targetGUID; // Always hits *data << ighit->targetGUID; // Always hits
data->put<uint8>(count_pos, hit);
*data << (uint8)miss; *data << (uint8)miss;
for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss
{ {
*data << ihit->targetGUID; *data << ihit->targetGUID;
*data << uint8(ihit->missCondition); *data << uint8(ihit->missCondition);
if( ihit->missCondition == SPELL_MISS_REFLECT ) if (ihit->missCondition == SPELL_MISS_REFLECT)
*data << uint8(ihit->reflectResult); *data << uint8(ihit->reflectResult);
} }
} }
@ -3965,7 +3965,7 @@ void Spell::SendChannelStart(uint32 duration)
// select first not resisted target from target list for _0_ effect // select first not resisted target from target list for _0_ effect
if (!m_UniqueTargetInfo.empty()) if (!m_UniqueTargetInfo.empty())
{ {
for(std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) for(TargetList::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)
{ {
if ((itr->effectMask & (1 << EFFECT_INDEX_0)) && itr->reflectResult == SPELL_MISS_NONE && if ((itr->effectMask & (1 << EFFECT_INDEX_0)) && itr->reflectResult == SPELL_MISS_NONE &&
itr->targetGUID != m_caster->GetObjectGuid()) itr->targetGUID != m_caster->GetObjectGuid())
@ -3977,7 +3977,7 @@ void Spell::SendChannelStart(uint32 duration)
} }
else if(!m_UniqueGOTargetInfo.empty()) else if(!m_UniqueGOTargetInfo.empty())
{ {
for(std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) for(GOTargetList::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr)
{ {
if (itr->effectMask & (1 << EFFECT_INDEX_0)) if (itr->effectMask & (1 << EFFECT_INDEX_0))
{ {
@ -4302,7 +4302,7 @@ void Spell::HandleThreatSpells()
// since 2.0.1 threat from positive effects also is distributed among all targets, so the overall caused threat is at most the defined bonus // since 2.0.1 threat from positive effects also is distributed among all targets, so the overall caused threat is at most the defined bonus
threat /= m_UniqueTargetInfo.size(); threat /= m_UniqueTargetInfo.size();
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if (ihit->missCondition != SPELL_MISS_NONE) if (ihit->missCondition != SPELL_MISS_NONE)
continue; continue;
@ -5773,8 +5773,8 @@ bool Spell::CanAutoCast(Unit* target)
{ {
FillTargetMap(); FillTargetMap();
//check if among target units, our WANTED target is as well (->only self cast spells return false) //check if among target units, our WANTED target is as well (->only self cast spells return false)
for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if( ihit->targetGUID == targetguid ) if (ihit->targetGUID == targetguid)
return true; return true;
} }
return false; //target invalid return false; //target invalid
@ -6497,7 +6497,7 @@ void Spell::DelayedChannel()
DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer);
for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{ {
if ((*ihit).missCondition == SPELL_MISS_NONE) if ((*ihit).missCondition == SPELL_MISS_NONE)
{ {
@ -6680,15 +6680,15 @@ bool Spell::IsTriggeredSpellWithRedundentData() const
bool Spell::HaveTargetsForEffect(SpellEffectIndex effect) const bool Spell::HaveTargetsForEffect(SpellEffectIndex effect) const
{ {
for(std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) for(TargetList::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)
if(itr->effectMask & (1 << effect)) if(itr->effectMask & (1 << effect))
return true; return true;
for(std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) for(GOTargetList::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr)
if(itr->effectMask & (1 << effect)) if(itr->effectMask & (1 << effect))
return true; return true;
for(std::list<ItemTargetInfo>::const_iterator itr = m_UniqueItemInfo.begin(); itr != m_UniqueItemInfo.end(); ++itr) for(ItemTargetList::const_iterator itr = m_UniqueItemInfo.begin(); itr != m_UniqueItemInfo.end(); ++itr)
if(itr->effectMask & (1 << effect)) if(itr->effectMask & (1 << effect))
return true; return true;

View file

@ -393,8 +393,8 @@ class Spell
void DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc = 0); void DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc = 0);
void DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction = 0); void DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction = 0);
void WriteSpellGoTargets( WorldPacket * data ); void WriteSpellGoTargets(WorldPacket* data);
void WriteAmmoToPacket( WorldPacket * data ); void WriteAmmoToPacket(WorldPacket* data);
typedef std::list<Unit*> UnitList; typedef std::list<Unit*> UnitList;
void FillTargetMap(); void FillTargetMap();
@ -581,7 +581,6 @@ class Spell
uint8 effectMask:8; uint8 effectMask:8;
bool processed:1; bool processed:1;
}; };
std::list<TargetInfo> m_UniqueTargetInfo;
uint8 m_needAliveTargetMask; // Mask req. alive targets uint8 m_needAliveTargetMask; // Mask req. alive targets
struct GOTargetInfo struct GOTargetInfo
@ -591,14 +590,20 @@ class Spell
uint8 effectMask:8; uint8 effectMask:8;
bool processed:1; bool processed:1;
}; };
std::list<GOTargetInfo> m_UniqueGOTargetInfo;
struct ItemTargetInfo struct ItemTargetInfo
{ {
Item *item; Item *item;
uint8 effectMask; uint8 effectMask;
}; };
std::list<ItemTargetInfo> m_UniqueItemInfo;
typedef std::list<TargetInfo> TargetList;
typedef std::list<GOTargetInfo> GOTargetList;
typedef std::list<ItemTargetInfo> ItemTargetList;
TargetList m_UniqueTargetInfo;
GOTargetList m_UniqueGOTargetInfo;
ItemTargetList m_UniqueItemInfo;
void AddUnitTarget(Unit* target, SpellEffectIndex effIndex); void AddUnitTarget(Unit* target, SpellEffectIndex effIndex);
void AddUnitTarget(uint64 unitGUID, SpellEffectIndex effIndex); void AddUnitTarget(uint64 unitGUID, SpellEffectIndex effIndex);

View file

@ -326,7 +326,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
case 72624: case 72625: // Ooze Eruption case 72624: case 72625: // Ooze Eruption
{ {
uint32 count = 0; uint32 count = 0;
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if(ihit->effectMask & (1<<effect_idx)) if(ihit->effectMask & (1<<effect_idx))
++count; ++count;
@ -2761,7 +2761,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
// Righteous Defense (step 2) (in old version 31980 dummy effect) // Righteous Defense (step 2) (in old version 31980 dummy effect)
// Clear targets for eff 1 // Clear targets for eff 1
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
ihit->effectMask &= ~(1<<1); ihit->effectMask &= ~(1<<1);
// not empty (checked), copy // not empty (checked), copy
@ -5641,7 +5641,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx)
case 71021: // Saber Lash case 71021: // Saber Lash
{ {
uint32 count = 0; uint32 count = 0;
for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if(ihit->effectMask & (1<<eff_idx)) if(ihit->effectMask & (1<<eff_idx))
++count; ++count;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11292" #define REVISION_NR "11293"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__