mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[7283] Use map for trainer spells for fast find data by spell id.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
02b4b2f0b1
commit
22656b33e3
5 changed files with 38 additions and 42 deletions
|
|
@ -46,18 +46,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue