[7093] Speedup spell learning code.

This commit is contained in:
VladimirMangos 2009-01-17 00:22:49 +03:00
parent ed14e59de4
commit a1e0900d37
2 changed files with 9 additions and 6 deletions

View file

@ -2855,12 +2855,15 @@ void Player::learnSpell(uint32 spell_id)
bool learning = addSpell(spell_id,active,true,false); bool learning = addSpell(spell_id,active,true,false);
// learn all disabled higher ranks (recursive) // learn all disabled higher ranks (recursive)
SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext(); if(disabled)
for(SpellChainMapNext::const_iterator i = nextMap.lower_bound(spell_id); i != nextMap.upper_bound(spell_id); ++i)
{ {
PlayerSpellMap::iterator iter = m_spells.find(i->second); SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext();
if (disabled && iter != m_spells.end() && iter->second->disabled) for(SpellChainMapNext::const_iterator i = nextMap.lower_bound(spell_id); i != nextMap.upper_bound(spell_id); ++i)
learnSpell(i->second); {
PlayerSpellMap::iterator iter = m_spells.find(i->second);
if (iter != m_spells.end() && iter->second->disabled)
learnSpell(i->second);
}
} }
// prevent duplicated entires in spell book, also not send if not in world (loading) // prevent duplicated entires in spell book, also not send if not in world (loading)

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 "7092" #define REVISION_NR "7093"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__