[7283] Use map for trainer spells for fast find data by spell id. Author: zhenya
--HG-- branch : trunk
This commit is contained in:
+3
-10
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user