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/ObjectMgr.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/ObjectMgr.cpp')
-rw-r--r-- | src/game/ObjectMgr.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index b7dafe9a55a..dae60a230f1 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -7100,36 +7100,34 @@ void ObjectMgr::LoadTrainerSpell() continue; } - TrainerSpell* pTrainerSpell = new TrainerSpell(); - pTrainerSpell->spell = spell; - pTrainerSpell->spellCost = fields[2].GetUInt32(); - pTrainerSpell->reqSkill = fields[3].GetUInt32(); - pTrainerSpell->reqSkillValue = fields[4].GetUInt32(); - pTrainerSpell->reqLevel = fields[5].GetUInt32(); + TrainerSpellData& data = m_mCacheTrainerSpellMap[entry]; + + if(SpellMgr::IsProfessionSpell(spell)) + data.trainerType = 2; + + TrainerSpell& trainerSpell = data.spellList[spell]; + trainerSpell.spell = spell; + trainerSpell.spellCost = fields[2].GetUInt32(); + trainerSpell.reqSkill = fields[3].GetUInt32(); + trainerSpell.reqSkillValue = fields[4].GetUInt32(); + trainerSpell.reqLevel = fields[5].GetUInt32(); - if(!pTrainerSpell->reqLevel) - pTrainerSpell->reqLevel = spellinfo->spellLevel; + if(!trainerSpell.reqLevel) + trainerSpell.reqLevel = spellinfo->spellLevel; // calculate learned spell for profession case when stored cast-spell - pTrainerSpell->learnedSpell = spell; + trainerSpell.learnedSpell = spell; for(int i = 0; i <3; ++i) { - if(spellinfo->Effect[i]!=SPELL_EFFECT_LEARN_SPELL) + if(spellinfo->Effect[i] != SPELL_EFFECT_LEARN_SPELL) continue; - if(SpellMgr::IsProfessionOrRidingSpell(spellinfo->EffectTriggerSpell[i])) { - pTrainerSpell->learnedSpell = spellinfo->EffectTriggerSpell[i]; + trainerSpell.learnedSpell = spellinfo->EffectTriggerSpell[i]; break; } } - TrainerSpellData& data = m_mCacheTrainerSpellMap[entry]; - - if(SpellMgr::IsProfessionSpell(spell)) - data.trainerType = 2; - - data.spellList.push_back(pTrainerSpell); ++count; } while (result->NextRow()); |