[7283] Use map for trainer spells for fast find data by spell id. Author: zhenya

--HG--
branch : trunk
This commit is contained in:
megamage
2009-02-16 20:10:04 -06:00
parent 0a5b8f78f5
commit 319f70fb76
5 changed files with 38 additions and 42 deletions
+3 -10
View File
@@ -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;
}