diff options
| author | megamage <none@none> | 2009-07-31 10:21:57 +0800 |
|---|---|---|
| committer | megamage <none@none> | 2009-07-31 10:21:57 +0800 |
| commit | 2bddcc4303060a42e88a0478005c3c0368e3569a (patch) | |
| tree | 71becbc82b5bd711bd8699ad1cfb413e4f750fdc /src/game/SpellMgr.h | |
| parent | 4abac06cf0f16e576fe814ad52905c62acf5f0ba (diff) | |
[8251] Store in some DB tables only data for first rank. Author: VladimirMangos
* Allow add to DB data only for first rank in table `mangos_spell_bonus_data` and `mangos_spell_proc_event`.
* Copy data for other ranks for speedup use at loading for this data and data from `spell_proc_item_enchant`.
--HG--
branch : trunk
Diffstat (limited to 'src/game/SpellMgr.h')
| -rw-r--r-- | src/game/SpellMgr.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index f1d551298f0..be34f4af2eb 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -729,6 +729,10 @@ inline bool IsProfessionOrRidingSkill(uint32 skill) class SpellMgr { + friend struct DoSpellBonusess; + friend struct DoSpellProcEvent; + friend struct DoSpellProcItemEnchant; + // Constructors public: SpellMgr(); @@ -798,13 +802,7 @@ class SpellMgr SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId); if( itr != mSpellBonusMap.end( ) ) return &itr->second; - // Not found, try lookup for 1 spell rank if exist - if (uint32 rank_1 = GetFirstSpellInChain(spellId)) - { - SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1); - if( itr2 != mSpellBonusMap.end( ) ) - return &itr2->second; - } + return NULL; } @@ -862,6 +860,26 @@ class SpellMgr SpellsRequiringSpellMap const& GetSpellsRequiringSpell() const { return mSpellsReqSpell; } + template<typename Worker> + void doForThisAndHighRanks(uint32 spellid, Worker& worker) + { + worker(spellid); + if(uint32 nextSpellId = GetNextSpellInChain(spellid)) + doForThisAndHighRanks(nextSpellId, worker); + } + + template<typename Worker> + void doForHighRanks(uint32 spellid, Worker& worker) + { + if(uint32 nextSpellId = GetNextSpellInChain(spellid)) + { + worker(nextSpellId); + doForHighRanks(nextSpellId, worker); + } + } + + // Note: not use rank for compare to spell ranks: spell chains isn't linear order + // Use IsHighRankOfSpell instead uint8 GetSpellRank(uint32 spell_id) const { if(SpellChainNode const* node = GetSpellChainNode(spell_id)) |
