From a1e0900d375010df33d153f1ea23dd4e5dbc71af Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 17 Jan 2009 00:22:49 +0300 Subject: [PATCH] [7093] Speedup spell learning code. --- src/game/Player.cpp | 13 ++++++++----- src/shared/revision_nr.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f71bc979c..fdb03f95c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2855,12 +2855,15 @@ void Player::learnSpell(uint32 spell_id) bool learning = addSpell(spell_id,active,true,false); // learn all disabled higher ranks (recursive) - SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext(); - for(SpellChainMapNext::const_iterator i = nextMap.lower_bound(spell_id); i != nextMap.upper_bound(spell_id); ++i) + if(disabled) { - PlayerSpellMap::iterator iter = m_spells.find(i->second); - if (disabled && iter != m_spells.end() && iter->second->disabled) - learnSpell(i->second); + SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext(); + 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); + 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) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d159296e9..e80f58286 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7092" + #define REVISION_NR "7093" #endif // __REVISION_NR_H__