diff options
Diffstat (limited to 'src/game/SpellMgr.h')
-rw-r--r-- | src/game/SpellMgr.h | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 934f63a1684..f9ec824e668 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -612,6 +612,7 @@ struct SpellTargetEntry }; typedef std::multimap<uint32,SpellTargetEntry> SpellScriptTarget; +typedef std::pair<SpellScriptTarget::const_iterator,SpellScriptTarget::const_iterator> SpellScriptTargetBounds; // coordinates for spells (accessed using SpellMgr functions) struct SpellTargetPosition @@ -734,8 +735,10 @@ struct SpellLearnSpellNode }; typedef std::multimap<uint32, SpellLearnSpellNode> SpellLearnSpellMap; +typedef std::pair<SpellLearnSpellMap::const_iterator,SpellLearnSpellMap::const_iterator> SpellLearnSpellMapBounds; typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap; +typedef std::pair<SkillLineAbilityMap::const_iterator,SkillLineAbilityMap::const_iterator> SkillLineAbilityMapBounds; typedef std::multimap<uint32, uint32> PetLevelupSpellSet; typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap; @@ -1000,22 +1003,16 @@ class SpellMgr return mSpellLearnSpells.find(spell_id) != mSpellLearnSpells.end(); } - SpellLearnSpellMap::const_iterator GetBeginSpellLearnSpell(uint32 spell_id) const + SpellLearnSpellMapBounds GetSpellLearnSpellMapBounds(uint32 spell_id) const { - return mSpellLearnSpells.lower_bound(spell_id); - } - - SpellLearnSpellMap::const_iterator GetEndSpellLearnSpell(uint32 spell_id) const - { - return mSpellLearnSpells.upper_bound(spell_id); + return SpellLearnSpellMapBounds(mSpellLearnSpells.lower_bound(spell_id),mSpellLearnSpells.upper_bound(spell_id)); } bool IsSpellLearnToSpell(uint32 spell_id1,uint32 spell_id2) const { - SpellLearnSpellMap::const_iterator b = GetBeginSpellLearnSpell(spell_id1); - SpellLearnSpellMap::const_iterator e = GetEndSpellLearnSpell(spell_id1); - for(SpellLearnSpellMap::const_iterator i = b; i != e; ++i) - if(i->second.spell==spell_id2) + SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1); + for(SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i) + if (i->second.spell==spell_id2) return true; return false; } @@ -1030,27 +1027,17 @@ class SpellMgr // Spell script targets - SpellScriptTarget::const_iterator GetBeginSpellScriptTarget(uint32 spell_id) const + SpellScriptTargetBounds GetSpellScriptTargetBounds(uint32 spell_id) const { - return mSpellScriptTarget.lower_bound(spell_id); - } - - SpellScriptTarget::const_iterator GetEndSpellScriptTarget(uint32 spell_id) const - { - return mSpellScriptTarget.upper_bound(spell_id); + return SpellScriptTargetBounds(mSpellScriptTarget.lower_bound(spell_id),mSpellScriptTarget.upper_bound(spell_id)); } // Spell correctess for client using static bool IsSpellValid(SpellEntry const * spellInfo, Player* pl = NULL, bool msg = true); - SkillLineAbilityMap::const_iterator GetBeginSkillLineAbilityMap(uint32 spell_id) const - { - return mSkillLineAbilityMap.lower_bound(spell_id); - } - - SkillLineAbilityMap::const_iterator GetEndSkillLineAbilityMap(uint32 spell_id) const + SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const { - return mSkillLineAbilityMap.upper_bound(spell_id); + return SkillLineAbilityMapBounds(mSkillLineAbilityMap.lower_bound(spell_id),mSkillLineAbilityMap.upper_bound(spell_id)); } PetAura const* GetPetAura(uint32 spell_id, uint8 eff) |