mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[7730] Some optimizantion and code style.
Signed-off-by: AlexDereka <dereka.alex@gmail.com>
This commit is contained in:
parent
a4373c887d
commit
8144f30199
69 changed files with 536 additions and 536 deletions
|
|
@ -427,7 +427,7 @@ void Spell::FillTargetMap()
|
|||
{
|
||||
// TODO: ADD the correct target FILLS!!!!!!
|
||||
|
||||
for(uint32 i=0;i<3;i++)
|
||||
for(uint32 i=0;i<3;++i)
|
||||
{
|
||||
// not call for empty effect.
|
||||
// Also some spells use not used effect targets for store targets for dummy effect in triggered spells
|
||||
|
|
@ -739,7 +739,7 @@ void Spell::FillTargetMap()
|
|||
++itr;
|
||||
}
|
||||
|
||||
for(std::list<Unit*>::iterator iunit= tmpUnitMap.begin();iunit != tmpUnitMap.end();++iunit)
|
||||
for(std::list<Unit*>::const_iterator iunit= tmpUnitMap.begin();iunit != tmpUnitMap.end();++iunit)
|
||||
AddUnitTarget((*iunit), i);
|
||||
}
|
||||
}
|
||||
|
|
@ -1260,7 +1260,7 @@ bool Spell::IsAliveUnitPresentInTargetList()
|
|||
|
||||
uint8 needAliveTargetMask = m_needAliveTargetMask;
|
||||
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
{
|
||||
if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) )
|
||||
{
|
||||
|
|
@ -2272,7 +2272,7 @@ void Spell::cancel()
|
|||
|
||||
case SPELL_STATE_CASTING:
|
||||
{
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
{
|
||||
if( ihit->missCondition == SPELL_MISS_NONE )
|
||||
{
|
||||
|
|
@ -2751,7 +2751,7 @@ void Spell::finish(bool ok)
|
|||
{
|
||||
if (!(*i)->isAffectedOnSpell(m_spellInfo))
|
||||
continue;
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
if( ihit->missCondition == SPELL_MISS_NONE )
|
||||
{
|
||||
// check m_caster->GetGUID() let load auras at login and speedup most often case
|
||||
|
|
@ -2788,7 +2788,7 @@ void Spell::finish(bool ok)
|
|||
// Not drop combopoints if negative spell and if any miss on enemy exist
|
||||
bool needDrop = true;
|
||||
if (!IsPositiveSpell(m_spellInfo->Id))
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
if (ihit->missCondition != SPELL_MISS_NONE && ihit->targetGUID!=m_caster->GetGUID())
|
||||
{
|
||||
needDrop = false;
|
||||
|
|
@ -3065,18 +3065,18 @@ void Spell::WriteSpellGoTargets( WorldPacket * data )
|
|||
}
|
||||
|
||||
*data << (uint8)hit;
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
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 << uint64(ihit->targetGUID);
|
||||
m_needAliveTargetMask |=ihit->effectMask;
|
||||
}
|
||||
|
||||
for(std::list<GOTargetInfo>::iterator ighit= m_UniqueGOTargetInfo.begin();ighit != m_UniqueGOTargetInfo.end();++ighit)
|
||||
for(std::list<GOTargetInfo>::const_iterator ighit= m_UniqueGOTargetInfo.begin();ighit != m_UniqueGOTargetInfo.end();++ighit)
|
||||
*data << uint64(ighit->targetGUID); // Always hits
|
||||
|
||||
*data << (uint8)miss;
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
{
|
||||
if( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss
|
||||
{
|
||||
|
|
@ -3242,7 +3242,7 @@ void Spell::SendChannelStart(uint32 duration)
|
|||
// select first not resisted target from target list for _0_ effect
|
||||
if(!m_UniqueTargetInfo.empty())
|
||||
{
|
||||
for(std::list<TargetInfo>::iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr)
|
||||
for(std::list<TargetInfo>::const_iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr)
|
||||
{
|
||||
if( (itr->effectMask & (1<<0)) && itr->reflectResult==SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID())
|
||||
{
|
||||
|
|
@ -3253,7 +3253,7 @@ void Spell::SendChannelStart(uint32 duration)
|
|||
}
|
||||
else if(!m_UniqueGOTargetInfo.empty())
|
||||
{
|
||||
for(std::list<GOTargetInfo>::iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr)
|
||||
for(std::list<GOTargetInfo>::const_iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr)
|
||||
{
|
||||
if(itr->effectMask & (1<<0) )
|
||||
{
|
||||
|
|
@ -3605,7 +3605,7 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar
|
|||
|
||||
void Spell::TriggerSpell()
|
||||
{
|
||||
for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si)
|
||||
for(TriggerSpells::const_iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si)
|
||||
{
|
||||
Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer);
|
||||
spell->prepare(&m_targets); // use original spell original targets
|
||||
|
|
@ -3705,7 +3705,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
// auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode
|
||||
// this case can be triggered if rank not found (too low-level target for first rank)
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER && !IsPassiveSpell(m_spellInfo->Id) && !m_CastItem)
|
||||
for(int i=0;i<3;i++)
|
||||
for(int i=0;i<3;++i)
|
||||
if(IsPositiveEffect(m_spellInfo->Id, i) && m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
|
||||
if(target->getLevel() + 10 < m_spellInfo->spellLevel)
|
||||
return SPELL_FAILED_LOWLEVEL;
|
||||
|
|
@ -3995,7 +3995,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
return castResult;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
// for effects of spells that have only one target
|
||||
switch(m_spellInfo->Effect[i])
|
||||
|
|
@ -4331,7 +4331,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
switch(m_spellInfo->EffectApplyAuraName[i])
|
||||
{
|
||||
|
|
@ -4458,7 +4458,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
|
|||
target = m_targets.getUnitTarget();
|
||||
|
||||
bool need = false;
|
||||
for(uint32 i = 0;i<3;i++)
|
||||
for(uint32 i = 0;i<3;++i)
|
||||
{
|
||||
if(m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_DAMAGE || m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_FRIEND || m_spellInfo->EffectImplicitTargetA[i] == TARGET_DUELVSPLAYER || m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_PARTY || m_spellInfo->EffectImplicitTargetA[i] == TARGET_CURRENT_ENEMY_COORDINATES)
|
||||
{
|
||||
|
|
@ -4635,7 +4635,7 @@ bool Spell::CanAutoCast(Unit* target)
|
|||
{
|
||||
FillTargetMap();
|
||||
//check if among target units, our WANTED target is as well (->only self cast spells return false)
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
if( ihit->targetGUID == targetguid )
|
||||
return true;
|
||||
}
|
||||
|
|
@ -4808,7 +4808,7 @@ SpellCastResult Spell::CheckItems()
|
|||
if(!proto)
|
||||
return SPELL_FAILED_ITEM_NOT_READY;
|
||||
|
||||
for (int i = 0; i<5; i++)
|
||||
for (int i = 0; i<5; ++i)
|
||||
if (proto->Spells[i].SpellCharges)
|
||||
if(m_CastItem->GetSpellCharges(i)==0)
|
||||
return SPELL_FAILED_NO_CHARGES_REMAIN;
|
||||
|
|
@ -4818,7 +4818,7 @@ SpellCastResult Spell::CheckItems()
|
|||
{
|
||||
// such items should only fail if there is no suitable effect at all - see Rejuvenation Potions for example
|
||||
SpellCastResult failReason = SPELL_CAST_OK;
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
// skip check, pet not required like checks, and for TARGET_PET m_targets.getUnitTarget() is not the real target but the caster
|
||||
if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_PET)
|
||||
|
|
@ -4908,7 +4908,7 @@ SpellCastResult Spell::CheckItems()
|
|||
// check reagents (ignore triggered spells with reagents processed by original spell) and special reagent ignore case.
|
||||
if (!m_IsTriggeredSpell && !p_caster->CanNoReagentCast(m_spellInfo))
|
||||
{
|
||||
for(uint32 i=0;i<8;i++)
|
||||
for(uint32 i=0;i<8;++i)
|
||||
{
|
||||
if(m_spellInfo->Reagent[i] <= 0)
|
||||
continue;
|
||||
|
|
@ -4974,7 +4974,7 @@ SpellCastResult Spell::CheckItems()
|
|||
return SPELL_FAILED_TOTEM_CATEGORY; //0x7B
|
||||
|
||||
// special checks for spell effects
|
||||
for(int i = 0; i < 3; i++)
|
||||
for(int i = 0; i < 3; ++i)
|
||||
{
|
||||
switch (m_spellInfo->Effect[i])
|
||||
{
|
||||
|
|
@ -5248,7 +5248,7 @@ void Spell::DelayedChannel()
|
|||
|
||||
sLog.outDebug("Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer);
|
||||
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
for(std::list<TargetInfo>::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
{
|
||||
if ((*ihit).missCondition == SPELL_MISS_NONE)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue