[8236] Implemented explicit remove of Aura by pointer to it (used for single cast auras).

* This can prevent removing single cast aura of same id and effect
  but different caster what can cause assert in next code.

Thanks Vladimir for hints.

Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
ApoC 2009-07-14 00:59:11 +02:00
parent 18ae2de853
commit 6b2b58cec9
4 changed files with 20 additions and 6 deletions

View file

@ -3892,10 +3892,10 @@ void Unit::RemoveNotOwnSingleTargetAuras()
for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end(); )
{
Aura* aura = *iter;
if (aura->GetTarget()!=this)
if (aura->GetTarget() != this)
{
scAuras.erase(iter); // explicitly remove, instead waiting remove in RemoveAura
aura->GetTarget()->RemoveAura(aura->GetId(),aura->GetEffIndex());
aura->GetTarget()->RemoveAura(aura);
iter = scAuras.begin();
}
else
@ -3904,6 +3904,21 @@ void Unit::RemoveNotOwnSingleTargetAuras()
}
void Unit::RemoveAura(Aura* aura)
{
AuraMap::iterator i = m_Auras.lower_bound(spellEffectPair(aura->GetId(), aura->GetEffIndex()));
AuraMap::iterator upperBound = m_Auras.upper_bound(spellEffectPair(aura->GetId(), aura->GetEffIndex()));
for (; i != upperBound; ++i)
{
if (i->second == aura)
{
RemoveAura(i);
return;
}
}
sLog.outDebug("Trying to remove aura id %u effect %u by pointer but aura not found on target", aura->GetId(), aura->GetEffIndex());
}
void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
{
Aura* Aur = i->second;