diff options
| author | megamage <none@none> | 2009-07-07 07:26:11 +0800 | 
|---|---|---|
| committer | megamage <none@none> | 2009-07-07 07:26:11 +0800 | 
| commit | af1c18852446e6be81376a98eba8e2543985479d (patch) | |
| tree | 7330c340950ea9a77fe7862e7574dd3515caa759 /src/game/SpellEffects.cpp | |
| parent | 3eab803495bb5b43914415b730375692d6f284b1 (diff) | |
[8125] Optimized spell cooldowns remove. Author: ApoC
    Traverse only active cooldowns instead of whole player spell map.
--HG--
branch : trunk
Diffstat (limited to 'src/game/SpellEffects.cpp')
| -rw-r--r-- | src/game/SpellEffects.cpp | 36 | 
1 files changed, 18 insertions, 18 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 67b87d7c93e..d8828e3f26b 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1328,21 +1328,19 @@ void Spell::EffectDummy(uint32 i)                          return;                      // immediately finishes the cooldown on Frost spells -                    const PlayerSpellMap& sp_list = ((Player *)m_caster)->GetSpellMap(); -                    for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) +                    const SpellCooldowns& cm = ((Player *)m_caster)->GetSpellCooldownMap(); +                    for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)                      { -                        if (itr->second->state == PLAYERSPELL_REMOVED) -                            continue; - -                        uint32 classspell = itr->first; -                        SpellEntry const *spellInfo = sSpellStore.LookupEntry(classspell); +                        SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);                          if( spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&                              (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&                              spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 )                          { -                            ((Player*)m_caster)->RemoveSpellCooldown(classspell, true); +                            ((Player*)m_caster)->RemoveSpellCooldown((itr++)->first, true);                          } +                        else +                            ++itr;                      }                      return;                  } @@ -1619,14 +1617,15 @@ void Spell::EffectDummy(uint32 i)                          return;                      //immediately finishes the cooldown on certain Rogue abilities -                    const PlayerSpellMap& sp_list = ((Player *)m_caster)->GetSpellMap(); -                    for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) +                    const SpellCooldowns& cm = ((Player *)m_caster)->GetSpellCooldownMap(); +                    for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)                      { -                        uint32 classspell = itr->first; -                        SpellEntry const *spellInfo = sSpellStore.LookupEntry(classspell); +                        SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);                          if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (spellInfo->SpellFamilyFlags[1] & 0x00000240 || spellInfo->SpellFamilyFlags[0] & 0x00000860)) -                            ((Player*)m_caster)->RemoveSpellCooldown(classspell,true); +                            ((Player*)m_caster)->RemoveSpellCooldown((itr++)->first,true); +                        else +                            ++itr;                      }                      return;                  } @@ -1646,14 +1645,15 @@ void Spell::EffectDummy(uint32 i)                          return;                      //immediately finishes the cooldown for hunter abilities -                    const PlayerSpellMap& sp_list = ((Player *)m_caster)->GetSpellMap(); -                    for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) +                    const SpellCooldowns& cm = ((Player*)m_caster)->GetSpellCooldownMap(); +                    for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)                      { -                        uint32 classspell = itr->first; -                        SpellEntry const *spellInfo = sSpellStore.LookupEntry(classspell); +                        SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);                          if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && GetSpellRecoveryTime(spellInfo) > 0 ) -                            ((Player*)m_caster)->RemoveSpellCooldown(classspell,true); +                            ((Player*)m_caster)->RemoveSpellCooldown((itr++)->first,true); +                        else +                            ++itr;                      }                      return;                  }  | 
