aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellMgr.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-27 20:27:55 -0500
committermegamage <none@none>2009-08-27 20:27:55 -0500
commitdd72b5524c01ef081e1a35f65a3967652a314e5f (patch)
treefa7c95cd02aa983f70ab0f983d1fc305cfa1e3e1 /src/game/SpellMgr.cpp
parenteeb18e51bb7a539116e0a92f1db557f8727042ff (diff)
[8426] Use upper/lower iterator pairs as result instead 2 function calls. Author: VladimirMangos
--HG-- branch : trunk
Diffstat (limited to 'src/game/SpellMgr.cpp')
-rw-r--r--src/game/SpellMgr.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index d34f611b7a7..1b7b5065af2 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -1233,9 +1233,7 @@ void SpellMgr::LoadSpellTargetPositions()
}
if(found)
{
- SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(i);
- SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(i);
- if(lower == upper)
+ if(!spellmgr.GetSpellTargetPosition(i))
sLog.outDetail("Spell (ID: %u) does not have record in `spell_target_position`", i);
}
}
@@ -1704,10 +1702,9 @@ bool SpellMgr::IsPrimaryProfessionFirstRankSpell(uint32 spellId) const
bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const
{
- SkillLineAbilityMap::const_iterator lower = GetBeginSkillLineAbilityMap(spellId);
- SkillLineAbilityMap::const_iterator upper = GetEndSkillLineAbilityMap(spellId);
+ SkillLineAbilityMapBounds bounds = GetSkillLineAbilityMapBounds(spellId);
- for(SkillLineAbilityMap::const_iterator _spell_idx = lower; _spell_idx != upper; ++_spell_idx)
+ for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
{
SkillLineAbilityEntry const *pAbility = _spell_idx->second;
if (!pAbility || pAbility->learnOnGetSkill != ABILITY_LEARNED_ON_GET_PROFESSION_SKILL)
@@ -1885,11 +1882,10 @@ void SpellMgr::LoadSpellLearnSpells()
// other required explicit dependent learning
dbc_node.autoLearned = entry->EffectImplicitTargetA[i] == TARGET_UNIT_PET || GetTalentSpellCost(spell) > 0 || IsPassiveSpell(spell) || IsSpellHaveEffect(entry,SPELL_EFFECT_SKILL_STEP);
- SpellLearnSpellMap::const_iterator db_node_begin = GetBeginSpellLearnSpell(spell);
- SpellLearnSpellMap::const_iterator db_node_end = GetEndSpellLearnSpell(spell);
+ SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell);
bool found = false;
- for(SpellLearnSpellMap::const_iterator itr = db_node_begin; itr != db_node_end; ++itr)
+ for(SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr)
{
if(itr->second.spell == dbc_node.spell)
{
@@ -2060,9 +2056,8 @@ void SpellMgr::LoadSpellScriptTarget()
}
if(found)
{
- SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(i);
- SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(i);
- if(lower == upper)
+ SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(i);
+ if(bounds.first==bounds.second)
sLog.outDetail("Spell (ID: %u) does not have record in `spell_script_target`", i);
}
}
@@ -3852,13 +3847,12 @@ void SpellMgr::LoadEnchantCustomAttr()
bool SpellMgr::IsSkillTypeSpell(uint32 spellId, SkillType type) const
{
- SkillLineAbilityMap::const_iterator lower = GetBeginSkillLineAbilityMap(spellId);
- SkillLineAbilityMap::const_iterator upper = GetEndSkillLineAbilityMap(spellId);
- for (;lower!=upper;++lower)
- {
- if (lower->second->skillId==type)
+ SkillLineAbilityMapBounds bounds = GetSkillLineAbilityMapBounds(spellId);
+
+ for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
+ if (_spell_idx->second->skillId == type)
return true;
- }
+
return false;
}
@@ -3937,9 +3931,8 @@ void SpellMgr::LoadSpellLinked()
bool SpellMgr::CheckDB() const
{
- SpellScriptTarget::const_iterator lower = GetBeginSpellScriptTarget(30531);
- SpellScriptTarget::const_iterator upper = GetEndSpellScriptTarget(30531);
- if(lower == upper || lower->second.targetEntry != 17256)
+ SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(30531);
+ if(bounds.first == bounds.second || bounds.first->second.targetEntry != 17256)
return false;
return true;