Core/Misc: Use equal_range instead of lower_bound/upper_bound calls where possible.
This commit is contained in:
1 parent
2292025bf9
commit
d36c4a91ba
9 files changed
+160
-104
No files matched your search
@@ -8220,8 +8220,8 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply,
|
||||
|
||||
if (form_change) // check aura active state from other form
|
||||
{
|
||||
AuraApplicationMap const& auras = GetAppliedAuras();
|
||||
for (AuraApplicationMap::const_iterator itr = auras.lower_bound(spellInfo->Id); itr != auras.upper_bound(spellInfo->Id); ++itr)
|
||||
AuraApplicationMapBounds range = GetAppliedAuras().equal_range(spellInfo->Id);
|
||||
for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
|
||||
if (!item || itr->second->GetBase()->GetCastItemGUID() == item->GetGUID())
|
||||
return;
|
||||
}
|
||||
@@ -8240,7 +8240,7 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply,
|
||||
}
|
||||
|
||||
if (item)
|
||||
RemoveAurasDueToItemSpell(item, spellInfo->Id); // un-apply all spells, not only at-equipped
|
||||
RemoveAurasDueToItemSpell(spellInfo->Id, item->GetGUID()); // un-apply all spells, not only at-equipped
|
||||
else
|
||||
RemoveAurasDueToSpell(spellInfo->Id); // un-apply spell (item set case)
|
||||
}
|
||||
@@ -13851,7 +13851,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
|
||||
CastSpell(this, enchant_spell_id, true, item);
|
||||
}
|
||||
else
|
||||
RemoveAurasDueToItemSpell(item, enchant_spell_id);
|
||||
RemoveAurasDueToItemSpell(enchant_spell_id, item->GetGUID());
|
||||
}
|
||||
break;
|
||||
case ITEM_ENCHANTMENT_TYPE_RESISTANCE:
|
||||
@@ -15360,14 +15360,14 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg)
|
||||
|
||||
// each-from-all exclusive group (< 0)
|
||||
// can be start if only all quests in prev quest exclusive group completed and rewarded
|
||||
ObjectMgr::ExclusiveQuestGroups::iterator iter2 = sObjectMgr->mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
|
||||
ObjectMgr::ExclusiveQuestGroups::iterator end = sObjectMgr->mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup());
|
||||
ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qPrevInfo->GetExclusiveGroup()));
|
||||
|
||||
ASSERT(iter2 != end); // always must be found if qPrevInfo->ExclusiveGroup != 0
|
||||
// always must be found if qPrevInfo->ExclusiveGroup != 0
|
||||
ASSERT(range.first != range.second);
|
||||
|
||||
for (; iter2 != end; ++iter2)
|
||||
for (; range.first != range.second; ++range.first)
|
||||
{
|
||||
uint32 exclude_Id = iter2->second;
|
||||
uint32 exclude_Id = range.first->second;
|
||||
|
||||
// skip checked quest id, only state of other quests in group is interesting
|
||||
if (exclude_Id == prevId)
|
||||
@@ -15393,14 +15393,14 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg)
|
||||
|
||||
// each-from-all exclusive group (< 0)
|
||||
// can be start if only all quests in prev quest exclusive group active
|
||||
ObjectMgr::ExclusiveQuestGroups::iterator iter2 = sObjectMgr->mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
|
||||
ObjectMgr::ExclusiveQuestGroups::iterator end = sObjectMgr->mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup());
|
||||
ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qPrevInfo->GetExclusiveGroup()));
|
||||
|
||||
ASSERT(iter2 != end); // always must be found if qPrevInfo->ExclusiveGroup != 0
|
||||
// always must be found if qPrevInfo->ExclusiveGroup != 0
|
||||
ASSERT(range.first != range.second);
|
||||
|
||||
for (; iter2 != end; ++iter2)
|
||||
for (; range.first != range.second; ++range.first)
|
||||
{
|
||||
uint32 exclude_Id = iter2->second;
|
||||
uint32 exclude_Id = range.first->second;
|
||||
|
||||
// skip checked quest id, only state of other quests in group is interesting
|
||||
if (exclude_Id == prevId)
|
||||
@@ -15531,14 +15531,14 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg)
|
||||
if (qInfo->GetExclusiveGroup() <= 0)
|
||||
return true;
|
||||
|
||||
ObjectMgr::ExclusiveQuestGroups::iterator iter = sObjectMgr->mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup());
|
||||
ObjectMgr::ExclusiveQuestGroups::iterator end = sObjectMgr->mExclusiveQuestGroups.upper_bound(qInfo->GetExclusiveGroup());
|
||||
ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qInfo->GetExclusiveGroup()));
|
||||
|
||||
ASSERT(iter != end); // always must be found if qInfo->ExclusiveGroup != 0
|
||||
// always must be found if qInfo->ExclusiveGroup != 0
|
||||
ASSERT(range.first != range.second);
|
||||
|
||||
for (; iter != end; ++iter)
|
||||
for (; range.first != range.second; ++range.first)
|
||||
{
|
||||
uint32 exclude_Id = iter->second;
|
||||
uint32 exclude_Id = range.first->second;
|
||||
|
||||
// skip checked quest id, only state of other quests in group is interesting
|
||||
if (exclude_Id == qInfo->GetQuestId())
|
||||
@@ -15546,7 +15546,7 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg)
|
||||
|
||||
// not allow have daily quest if daily quest from exclusive group already recently completed
|
||||
Quest const* Nquest = sObjectMgr->GetQuestTemplate(exclude_Id);
|
||||
if (!SatisfyQuestDay(Nquest, false) || !SatisfyQuestWeek(Nquest, false) || !SatisfyQuestSeasonal(Nquest,false))
|
||||
if (!SatisfyQuestDay(Nquest, false) || !SatisfyQuestWeek(Nquest, false) || !SatisfyQuestSeasonal(Nquest, false))
|
||||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
@@ -3401,8 +3401,11 @@ void Unit::_UnapplyAura(AuraApplication * aurApp, AuraRemoveMode removeMode)
|
||||
{
|
||||
// aura can be removed from unit only if it's applied on it, shouldn't happen
|
||||
ASSERT(aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) == aurApp);
|
||||
|
||||
uint32 spellId = aurApp->GetBase()->GetId();
|
||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
|
||||
AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
|
||||
|
||||
for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
|
||||
{
|
||||
if (iter->second == aurApp)
|
||||
{
|
||||
@@ -3492,20 +3495,33 @@ void Unit::RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode)
|
||||
ASSERT(aura->GetOwner() == this);
|
||||
|
||||
uint32 spellId = aura->GetId();
|
||||
for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId); ++itr)
|
||||
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
|
||||
|
||||
for (AuraMap::iterator itr = range.first; itr != range.second; ++itr)
|
||||
{
|
||||
if (itr->second == aura)
|
||||
{
|
||||
RemoveOwnedAura(itr, removeMode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
Aura* Unit::GetOwnedAura(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, Aura* except) const
|
||||
{
|
||||
for (AuraMap::const_iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId); ++itr)
|
||||
if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID) && (!itemCasterGUID || itr->second->GetCastItemGUID() == itemCasterGUID) && (!except || except != itr->second))
|
||||
AuraMapBounds range = m_ownedAuras.equal_range(spellId);
|
||||
for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr)
|
||||
{
|
||||
if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask)
|
||||
&& (!casterGUID || itr->second->GetCasterGUID() == casterGUID)
|
||||
&& (!itemCasterGUID || itr->second->GetCastItemGUID() == itemCasterGUID)
|
||||
&& (!except || except != itr->second))
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -3524,11 +3540,12 @@ void Unit::RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode)
|
||||
|
||||
void Unit::RemoveAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode)
|
||||
{
|
||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
|
||||
AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
|
||||
for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
|
||||
{
|
||||
Aura const* aura = iter->second->GetBase();
|
||||
if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
|
||||
&& (!caster || aura->GetCasterGUID() == caster))
|
||||
&& (!caster || aura->GetCasterGUID() == caster))
|
||||
{
|
||||
RemoveAura(iter, removeMode);
|
||||
return;
|
||||
@@ -3557,8 +3574,11 @@ void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode)
|
||||
// no need to remove
|
||||
if (aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) != aurApp || aurApp->GetBase()->IsRemoved())
|
||||
return;
|
||||
|
||||
uint32 spellId = aurApp->GetBase()->GetId();
|
||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
|
||||
AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
|
||||
|
||||
for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
|
||||
{
|
||||
if (aurApp == iter->second)
|
||||
{
|
||||
@@ -3596,11 +3616,12 @@ void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 casterGUID, uint8 reqEff
|
||||
|
||||
void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
|
||||
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
|
||||
for (AuraMap::iterator iter = range.first; iter != range.second;)
|
||||
{
|
||||
Aura* aura = iter->second;
|
||||
if ((aura->GetType() == UNIT_AURA_TYPE)
|
||||
&& (!casterGUID || aura->GetCasterGUID() == casterGUID))
|
||||
&& (!casterGUID || aura->GetCasterGUID() == casterGUID))
|
||||
{
|
||||
aura->ModStackAmount(-1, removeMode);
|
||||
return;
|
||||
@@ -3612,7 +3633,8 @@ void Unit::RemoveAuraFromStack(uint32 spellId, uint64 casterGUID, AuraRemoveMode
|
||||
|
||||
void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved/*= 1*/)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
|
||||
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
|
||||
for (AuraMap::iterator iter = range.first; iter != range.second;)
|
||||
{
|
||||
Aura* aura = iter->second;
|
||||
if (aura->GetCasterGUID() == casterGUID)
|
||||
@@ -3639,7 +3661,8 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId
|
||||
|
||||
void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
|
||||
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
|
||||
for (AuraMap::iterator iter = range.first; iter != range.second;)
|
||||
{
|
||||
Aura* aura = iter->second;
|
||||
if (aura->GetCasterGUID() == casterGUID)
|
||||
@@ -3712,14 +3735,14 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit*
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveAurasDueToItemSpell(Item* castItem, uint32 spellId)
|
||||
void Unit::RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid)
|
||||
{
|
||||
for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
|
||||
{
|
||||
if (!castItem || iter->second->GetBase()->GetCastItemGUID() == castItem->GetGUID())
|
||||
if (iter->second->GetBase()->GetCastItemGUID() == castItemGuid)
|
||||
{
|
||||
RemoveAura(iter);
|
||||
iter = m_appliedAuras.upper_bound(spellId); // overwrite by more appropriate
|
||||
iter = m_appliedAuras.lower_bound(spellId);
|
||||
}
|
||||
else
|
||||
++iter;
|
||||
@@ -3999,9 +4022,10 @@ void Unit::RemoveAllAurasExceptType(AuraType type)
|
||||
|
||||
void Unit::DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);++iter)
|
||||
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
|
||||
for (; range.first != range.second; ++range.first)
|
||||
{
|
||||
Aura* aura = iter->second;
|
||||
Aura* aura = range.first->second;
|
||||
if (!caster || aura->GetCasterGUID() == caster)
|
||||
{
|
||||
if (aura->GetDuration() < delaytime)
|
||||
@@ -4030,9 +4054,15 @@ void Unit::_ApplyAllAuraStatMods()
|
||||
|
||||
AuraEffect* Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
|
||||
{
|
||||
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr)
|
||||
if (itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
|
||||
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
|
||||
for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
|
||||
{
|
||||
if (itr->second->HasEffect(effIndex)
|
||||
&& (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
|
||||
{
|
||||
return itr->second->GetBase()->GetEffect(effIndex);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -4080,11 +4110,19 @@ AuraEffect* Unit::GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 f
|
||||
|
||||
AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, uint64 itemCasterGUID, uint8 reqEffMask, AuraApplication * except) const
|
||||
{
|
||||
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr)
|
||||
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
|
||||
for (; range.first != range.second; ++range.first)
|
||||
{
|
||||
Aura const* aura = itr->second->GetBase();
|
||||
if (((aura->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || aura->GetCasterGUID() == casterGUID) && (!itemCasterGUID || aura->GetCastItemGUID() == itemCasterGUID) && (!except || except != itr->second))
|
||||
return itr->second;
|
||||
AuraApplication* app = range.first->second;
|
||||
Aura const* aura = app->GetBase();
|
||||
|
||||
if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
|
||||
&& (!casterGUID || aura->GetCasterGUID() == casterGUID)
|
||||
&& (!itemCasterGUID || aura->GetCastItemGUID() == itemCasterGUID)
|
||||
&& (!except || except != app))
|
||||
{
|
||||
return app;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -4154,22 +4192,31 @@ void Unit::GetDispellableAuraList(Unit* caster, uint32 dispelMask, DispelCharges
|
||||
|
||||
bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
|
||||
{
|
||||
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr)
|
||||
if (itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
|
||||
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
|
||||
for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
|
||||
{
|
||||
if (itr->second->HasEffect(effIndex)
|
||||
&& (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 Unit::GetAuraCount(uint32 spellId) const
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr)
|
||||
AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
|
||||
|
||||
for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
|
||||
{
|
||||
if (!itr->second->GetBase()->GetStackAmount())
|
||||
count++;
|
||||
if (itr->second->GetBase()->GetStackAmount() == 0)
|
||||
++count;
|
||||
else
|
||||
count += (uint32)itr->second->GetBase()->GetStackAmount();
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -9682,7 +9729,8 @@ bool Unit::HasAuraState(AuraStateType flag, SpellInfo const* spellProto, Unit co
|
||||
// If aura with aurastate by caster not found return false
|
||||
if ((1<<(flag-1)) & PER_CASTER_AURA_STATE_MASK)
|
||||
{
|
||||
for (AuraStateAurasMap::const_iterator itr = m_auraStateAuras.lower_bound(flag); itr != m_auraStateAuras.upper_bound(flag); ++itr)
|
||||
AuraStateAurasMapBounds range = m_auraStateAuras.equal_range(flag);
|
||||
for (AuraStateAurasMap::const_iterator itr = range.first; itr != range.second; ++itr)
|
||||
if (itr->second->GetBase()->GetCasterGUID() == Caster->GetGUID())
|
||||
return true;
|
||||
return false;
|
||||
|
||||
@@ -1201,10 +1201,18 @@ class Unit : public WorldObject
|
||||
public:
|
||||
typedef std::set<Unit*> AttackerSet;
|
||||
typedef std::set<Unit*> ControlList;
|
||||
typedef std::pair<uint32, uint8> spellEffectPair;
|
||||
|
||||
typedef std::multimap<uint32, Aura*> AuraMap;
|
||||
typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> AuraMapBounds;
|
||||
typedef std::pair<AuraMap::iterator, AuraMap::iterator> AuraMapBoundsNonConst;
|
||||
|
||||
typedef std::multimap<uint32, AuraApplication*> AuraApplicationMap;
|
||||
typedef std::pair<AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator> AuraApplicationMapBounds;
|
||||
typedef std::pair<AuraApplicationMap::iterator, AuraApplicationMap::iterator> AuraApplicationMapBoundsNonConst;
|
||||
|
||||
typedef std::multimap<AuraStateType, AuraApplication*> AuraStateAurasMap;
|
||||
typedef std::pair<AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator> AuraStateAurasMapBounds;
|
||||
|
||||
typedef std::list<AuraEffect*> AuraEffectList;
|
||||
typedef std::list<Aura*> AuraList;
|
||||
typedef std::list<AuraApplication *> AuraApplicationList;
|
||||
@@ -1764,7 +1772,7 @@ class Unit : public WorldObject
|
||||
void RemoveAuraFromStack(uint32 spellId, uint64 casterGUID = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved = 1);
|
||||
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer);
|
||||
void RemoveAurasDueToItemSpell(Item* castItem, uint32 spellId);
|
||||
void RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid);
|
||||
void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura* except = NULL, bool negative = true, bool positive = true);
|
||||
void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0);
|
||||
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0);
|
||||
|
||||
@@ -5655,12 +5655,11 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
|
||||
// then check faction
|
||||
// if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated
|
||||
// then check faction
|
||||
GraveYardContainer::const_iterator graveLow = GraveYardStore.lower_bound(zoneId);
|
||||
GraveYardContainer::const_iterator graveUp = GraveYardStore.upper_bound(zoneId);
|
||||
GraveYardMapBounds range = GraveYardStore.equal_range(zoneId);
|
||||
MapEntry const* map = sMapStore.LookupEntry(MapId);
|
||||
// not need to check validity of map object; MapId _MUST_ be valid here
|
||||
|
||||
if (graveLow == graveUp && !map->IsBattleArena())
|
||||
// not need to check validity of map object; MapId _MUST_ be valid here
|
||||
if (range.first == range.second && !map->IsBattleArena())
|
||||
{
|
||||
sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
|
||||
return GetDefaultGraveYard(team);
|
||||
@@ -5681,9 +5680,9 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
|
||||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(MapId);
|
||||
|
||||
for (GraveYardContainer::const_iterator itr = graveLow; itr != graveUp; ++itr)
|
||||
for (; range.first != range.second; ++range.first)
|
||||
{
|
||||
GraveYardData const& data = itr->second;
|
||||
GraveYardData const& data = range.first->second;
|
||||
|
||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId);
|
||||
if (!entry)
|
||||
@@ -5761,15 +5760,13 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
|
||||
|
||||
GraveYardData const* ObjectMgr::FindGraveYardData(uint32 id, uint32 zoneId)
|
||||
{
|
||||
GraveYardContainer::const_iterator graveLow = GraveYardStore.lower_bound(zoneId);
|
||||
GraveYardContainer::const_iterator graveUp = GraveYardStore.upper_bound(zoneId);
|
||||
|
||||
for (GraveYardContainer::const_iterator itr = graveLow; itr != graveUp; ++itr)
|
||||
GraveYardMapBounds range = GraveYardStore.equal_range(zoneId);
|
||||
for (; range.first != range.second; ++range.first)
|
||||
{
|
||||
if (itr->second.safeLocId == id)
|
||||
return &itr->second;
|
||||
GraveYardData const& data = range.first->second;
|
||||
if (data.safeLocId == id)
|
||||
return &data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -5802,9 +5799,8 @@ bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool per
|
||||
|
||||
void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool persist /*= false*/)
|
||||
{
|
||||
GraveYardContainer::iterator graveLow = GraveYardStore.lower_bound(zoneId);
|
||||
GraveYardContainer::iterator graveUp = GraveYardStore.upper_bound(zoneId);
|
||||
if (graveLow == graveUp)
|
||||
GraveYardMapBoundsNonConst range = GraveYardStore.equal_range(zoneId);
|
||||
if (range.first == range.second)
|
||||
{
|
||||
//sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
|
||||
return;
|
||||
@@ -5812,11 +5808,10 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
|
||||
|
||||
bool found = false;
|
||||
|
||||
GraveYardContainer::iterator itr;
|
||||
|
||||
for (itr = graveLow; itr != graveUp; ++itr)
|
||||
for (; range.first != range.second; ++range.first)
|
||||
{
|
||||
GraveYardData & data = itr->second;
|
||||
GraveYardData & data = range.first->second;
|
||||
|
||||
// skip not matching safezone id
|
||||
if (data.safeLocId != id)
|
||||
@@ -5836,7 +5831,7 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
|
||||
return;
|
||||
|
||||
// remove from links
|
||||
GraveYardStore.erase(itr);
|
||||
GraveYardStore.erase(range.first);
|
||||
|
||||
// remove link from DB
|
||||
if (persist)
|
||||
|
||||
@@ -564,6 +564,8 @@ struct GraveYardData
|
||||
};
|
||||
|
||||
typedef std::multimap<uint32, GraveYardData> GraveYardContainer;
|
||||
typedef std::pair<GraveYardContainer::const_iterator, GraveYardContainer::const_iterator> GraveYardMapBounds;
|
||||
typedef std::pair<GraveYardContainer::iterator, GraveYardContainer::iterator> GraveYardMapBoundsNonConst;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemContainer;
|
||||
typedef UNORDERED_MAP<uint32, TrainerSpellData> CacheTrainerSpellContainer;
|
||||
@@ -960,6 +962,8 @@ class ObjectMgr
|
||||
uint32 GeneratePetNumber();
|
||||
|
||||
typedef std::multimap<int32, uint32> ExclusiveQuestGroups;
|
||||
typedef std::pair<ExclusiveQuestGroups::const_iterator, ExclusiveQuestGroups::const_iterator> ExclusiveQuestGroupsBounds;
|
||||
|
||||
ExclusiveQuestGroups mExclusiveQuestGroups;
|
||||
|
||||
MailLevelReward const* GetMailLevelReward(uint32 level, uint32 raceMask)
|
||||
@@ -1114,7 +1118,7 @@ class ObjectMgr
|
||||
|
||||
VendorItemData const* GetNpcVendorItemList(uint32 entry) const
|
||||
{
|
||||
CacheVendorItemContainer::const_iterator iter = _cacheVendorItemStore.find(entry);
|
||||
CacheVendorItemContainer::const_iterator iter = _cacheVendorItemStore.find(entry);
|
||||
if (iter == _cacheVendorItemStore.end())
|
||||
return NULL;
|
||||
|
||||
@@ -1131,26 +1135,26 @@ class ObjectMgr
|
||||
|
||||
SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
|
||||
{
|
||||
return SpellClickInfoMapBounds(_spellClickInfoStore.lower_bound(creature_id), _spellClickInfoStore.upper_bound(creature_id));
|
||||
return _spellClickInfoStore.equal_range(creature_id);
|
||||
}
|
||||
|
||||
GossipMenusMapBounds GetGossipMenusMapBounds(uint32 uiMenuId) const
|
||||
{
|
||||
return GossipMenusMapBounds(_gossipMenusStore.lower_bound(uiMenuId), _gossipMenusStore.upper_bound(uiMenuId));
|
||||
return _gossipMenusStore.equal_range(uiMenuId);
|
||||
}
|
||||
|
||||
GossipMenusMapBoundsNonConst GetGossipMenusMapBoundsNonConst(uint32 uiMenuId)
|
||||
{
|
||||
return GossipMenusMapBoundsNonConst(_gossipMenusStore.lower_bound(uiMenuId), _gossipMenusStore.upper_bound(uiMenuId));
|
||||
return _gossipMenusStore.equal_range(uiMenuId);
|
||||
}
|
||||
|
||||
GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds(uint32 uiMenuId) const
|
||||
{
|
||||
return GossipMenuItemsMapBounds(_gossipMenuItemsStore.lower_bound(uiMenuId), _gossipMenuItemsStore.upper_bound(uiMenuId));
|
||||
return _gossipMenuItemsStore.equal_range(uiMenuId);
|
||||
}
|
||||
GossipMenuItemsMapBoundsNonConst GetGossipMenuItemsMapBoundsNonConst(uint32 uiMenuId)
|
||||
{
|
||||
return GossipMenuItemsMapBoundsNonConst(_gossipMenuItemsStore.lower_bound(uiMenuId), _gossipMenuItemsStore.upper_bound(uiMenuId));
|
||||
return _gossipMenuItemsStore.equal_range(uiMenuId);
|
||||
}
|
||||
|
||||
// for wintergrasp only
|
||||
|
||||
@@ -295,6 +295,7 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
|
||||
// index instance ids by map/difficulty pairs for fast reset warning send
|
||||
typedef std::multimap<uint32 /*PAIR32(map, difficulty)*/, uint32 /*instanceid*/ > ResetTimeMapDiffInstances;
|
||||
typedef std::pair<ResetTimeMapDiffInstances::const_iterator, ResetTimeMapDiffInstances::const_iterator> ResetTimeMapDiffInstancesBounds;
|
||||
ResetTimeMapDiffInstances mapDiffResetInstances;
|
||||
|
||||
QueryResult result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance ORDER BY id ASC");
|
||||
@@ -378,8 +379,6 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
ResetTimeMapDiffInstances::const_iterator in_itr;
|
||||
|
||||
// calculate new global reset times for expired instances and those that have never been reset yet
|
||||
// add the global reset times to the priority queue
|
||||
for (MapDifficultyMap::const_iterator itr = sMapDifficultyMap.begin(); itr != sMapDifficultyMap.end(); ++itr)
|
||||
@@ -423,8 +422,9 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
|
||||
ScheduleReset(true, t - ResetTimeDelay[type-1], InstResetEvent(type, mapid, difficulty, 0));
|
||||
|
||||
for (in_itr = mapDiffResetInstances.lower_bound(map_diff_pair); in_itr != mapDiffResetInstances.upper_bound(map_diff_pair); ++in_itr)
|
||||
ScheduleReset(true, t - ResetTimeDelay[type-1], InstResetEvent(type, mapid, difficulty, in_itr->second));
|
||||
ResetTimeMapDiffInstancesBounds range = mapDiffResetInstances.equal_range(map_diff_pair);
|
||||
for (; range.first != range.second; ++range.first)
|
||||
ScheduleReset(true, t - ResetTimeDelay[type-1], InstResetEvent(type, mapid, difficulty, range.first->second));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,24 +108,24 @@ void InstanceScript::UpdateMinionState(Creature* minion, EncounterState state)
|
||||
|
||||
void InstanceScript::UpdateDoorState(GameObject* door)
|
||||
{
|
||||
DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry());
|
||||
DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry());
|
||||
if (lower == upper)
|
||||
DoorInfoMapBounds range = doors.equal_range(door->GetEntry());
|
||||
if (range.first == range.second)
|
||||
return;
|
||||
|
||||
bool open = true;
|
||||
for (DoorInfoMap::iterator itr = lower; itr != upper && open; ++itr)
|
||||
for (; range.first != range.second && open; ++range.first)
|
||||
{
|
||||
switch (itr->second.type)
|
||||
DoorInfo const& info = range.first->second;
|
||||
switch (info.type)
|
||||
{
|
||||
case DOOR_TYPE_ROOM:
|
||||
open = (itr->second.bossInfo->state != IN_PROGRESS);
|
||||
open = (info.bossInfo->state != IN_PROGRESS);
|
||||
break;
|
||||
case DOOR_TYPE_PASSAGE:
|
||||
open = (itr->second.bossInfo->state == DONE);
|
||||
open = (info.bossInfo->state == DONE);
|
||||
break;
|
||||
case DOOR_TYPE_SPAWN_HOLE:
|
||||
open = (itr->second.bossInfo->state == IN_PROGRESS);
|
||||
open = (info.bossInfo->state == IN_PROGRESS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -137,14 +137,13 @@ void InstanceScript::UpdateDoorState(GameObject* door)
|
||||
|
||||
void InstanceScript::AddDoor(GameObject* door, bool add)
|
||||
{
|
||||
DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry());
|
||||
DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry());
|
||||
if (lower == upper)
|
||||
DoorInfoMapBounds range = doors.equal_range(door->GetEntry());
|
||||
if (range.first == range.second)
|
||||
return;
|
||||
|
||||
for (DoorInfoMap::iterator itr = lower; itr != upper; ++itr)
|
||||
for (; range.first != range.second; ++range.first)
|
||||
{
|
||||
DoorInfo const& data = itr->second;
|
||||
DoorInfo const& data = range.first->second;
|
||||
|
||||
if (add)
|
||||
{
|
||||
|
||||
@@ -126,6 +126,8 @@ struct MinionInfo
|
||||
};
|
||||
|
||||
typedef std::multimap<uint32 /*entry*/, DoorInfo> DoorInfoMap;
|
||||
typedef std::pair<DoorInfoMap::const_iterator, DoorInfoMap::const_iterator> DoorInfoMapBounds;
|
||||
|
||||
typedef std::map<uint32 /*entry*/, MinionInfo> MinionInfoMap;
|
||||
|
||||
class InstanceScript : public ZoneScript
|
||||
|
||||
@@ -573,12 +573,12 @@ uint32 SpellMgr::GetSpellWithRank(uint32 spell_id, uint32 rank, bool strict) con
|
||||
|
||||
SpellRequiredMapBounds SpellMgr::GetSpellsRequiredForSpellBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellRequiredMapBounds(mSpellReq.lower_bound(spell_id), mSpellReq.upper_bound(spell_id));
|
||||
return mSpellReq.equal_range(spell_id);
|
||||
}
|
||||
|
||||
SpellsRequiringSpellMapBounds SpellMgr::GetSpellsRequiringSpellBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellsRequiringSpellMapBounds(mSpellsReqSpell.lower_bound(spell_id), mSpellsReqSpell.upper_bound(spell_id));
|
||||
return mSpellsReqSpell.equal_range(spell_id);
|
||||
}
|
||||
|
||||
bool SpellMgr::IsSpellRequiringSpell(uint32 spellid, uint32 req_spellid) const
|
||||
@@ -618,7 +618,7 @@ SpellLearnSkillNode const* SpellMgr::GetSpellLearnSkill(uint32 spell_id) const
|
||||
|
||||
SpellLearnSpellMapBounds SpellMgr::GetSpellLearnSpellMapBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellLearnSpellMapBounds(mSpellLearnSpells.lower_bound(spell_id), mSpellLearnSpells.upper_bound(spell_id));
|
||||
return mSpellLearnSpells.equal_range(spell_id);
|
||||
}
|
||||
|
||||
bool SpellMgr::IsSpellLearnSpell(uint32 spell_id) const
|
||||
@@ -646,7 +646,7 @@ SpellTargetPosition const* SpellMgr::GetSpellTargetPosition(uint32 spell_id) con
|
||||
SpellSpellGroupMapBounds SpellMgr::GetSpellSpellGroupMapBounds(uint32 spell_id) const
|
||||
{
|
||||
spell_id = GetFirstSpellInChain(spell_id);
|
||||
return SpellSpellGroupMapBounds(mSpellSpellGroup.lower_bound(spell_id), mSpellSpellGroup.upper_bound(spell_id));
|
||||
return mSpellSpellGroup.equal_range(spell_id);
|
||||
}
|
||||
|
||||
bool SpellMgr::IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const
|
||||
@@ -662,7 +662,7 @@ bool SpellMgr::IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) con
|
||||
|
||||
SpellGroupSpellMapBounds SpellMgr::GetSpellGroupSpellMapBounds(SpellGroup group_id) const
|
||||
{
|
||||
return SpellGroupSpellMapBounds(mSpellGroupSpell.lower_bound(group_id), mSpellGroupSpell.upper_bound(group_id));
|
||||
return mSpellGroupSpell.equal_range(group_id);
|
||||
}
|
||||
|
||||
void SpellMgr::GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells) const
|
||||
@@ -1012,7 +1012,7 @@ SpellThreatEntry const* SpellMgr::GetSpellThreatEntry(uint32 spellID) const
|
||||
|
||||
SkillLineAbilityMapBounds SpellMgr::GetSkillLineAbilityMapBounds(uint32 spell_id) const
|
||||
{
|
||||
return SkillLineAbilityMapBounds(mSkillLineAbilityMap.lower_bound(spell_id), mSkillLineAbilityMap.upper_bound(spell_id));
|
||||
return mSkillLineAbilityMap.equal_range(spell_id);
|
||||
}
|
||||
|
||||
PetAura const* SpellMgr::GetPetAura(uint32 spell_id, uint8 eff)
|
||||
@@ -1062,27 +1062,27 @@ PetDefaultSpellsEntry const* SpellMgr::GetPetDefaultSpellsEntry(int32 id) const
|
||||
|
||||
SpellAreaMapBounds SpellMgr::GetSpellAreaMapBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellAreaMapBounds(mSpellAreaMap.lower_bound(spell_id), mSpellAreaMap.upper_bound(spell_id));
|
||||
return mSpellAreaMap.equal_range(spell_id);
|
||||
}
|
||||
|
||||
SpellAreaForQuestMapBounds SpellMgr::GetSpellAreaForQuestMapBounds(uint32 quest_id) const
|
||||
{
|
||||
return SpellAreaForQuestMapBounds(mSpellAreaForQuestMap.lower_bound(quest_id), mSpellAreaForQuestMap.upper_bound(quest_id));
|
||||
return mSpellAreaForQuestMap.equal_range(quest_id);
|
||||
}
|
||||
|
||||
SpellAreaForQuestMapBounds SpellMgr::GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const
|
||||
{
|
||||
return SpellAreaForQuestMapBounds(mSpellAreaForQuestEndMap.lower_bound(quest_id), mSpellAreaForQuestEndMap.upper_bound(quest_id));
|
||||
return mSpellAreaForQuestEndMap.equal_range(quest_id);
|
||||
}
|
||||
|
||||
SpellAreaForAuraMapBounds SpellMgr::GetSpellAreaForAuraMapBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellAreaForAuraMapBounds(mSpellAreaForAuraMap.lower_bound(spell_id), mSpellAreaForAuraMap.upper_bound(spell_id));
|
||||
return mSpellAreaForAuraMap.equal_range(spell_id);
|
||||
}
|
||||
|
||||
SpellAreaForAreaMapBounds SpellMgr::GetSpellAreaForAreaMapBounds(uint32 area_id) const
|
||||
{
|
||||
return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id), mSpellAreaForAreaMap.upper_bound(area_id));
|
||||
return mSpellAreaForAreaMap.equal_range(area_id);
|
||||
}
|
||||
|
||||
bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 newArea) const
|
||||
|
||||
Reference in new issue
Block a user