diff options
author | megamage <none@none> | 2009-02-16 20:10:04 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-02-16 20:10:04 -0600 |
commit | 319f70fb7612f2b25943b7f823da16eb80cde1a3 (patch) | |
tree | 2786d783dd4a746ac06c2dac6daecf1558253e9d /src/game/Creature.cpp | |
parent | 0a5b8f78f5aeabb0dac9b5d35e8685f62ac1d3e0 (diff) |
[7283] Use map for trainer spells for fast find data by spell id. Author: zhenya
--HG--
branch : trunk
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r-- | src/game/Creature.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index d9cd7b6a0c8..eeee530bae1 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -51,18 +51,11 @@ // apply implementation of the singletons #include "Policies/SingletonImp.h" -void TrainerSpellData::Clear() -{ - for (TrainerSpellList::iterator itr = spellList.begin(); itr != spellList.end(); ++itr) - delete (*itr); - spellList.clear(); -} - TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const { - for(TrainerSpellList::const_iterator itr = spellList.begin(); itr != spellList.end(); ++itr) - if((*itr)->spell == spell_id) - return *itr; + TrainerSpellMap::const_iterator itr = spellList.find(spell_id); + if (itr != spellList.end()) + return &itr->second; return NULL; } |