mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[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:
parent
18ae2de853
commit
6b2b58cec9
4 changed files with 20 additions and 6 deletions
|
|
@ -6952,9 +6952,7 @@ void Aura::UnregisterSingleCastAura()
|
||||||
{
|
{
|
||||||
if (IsSingleTarget())
|
if (IsSingleTarget())
|
||||||
{
|
{
|
||||||
Unit* caster = NULL;
|
if(Unit* caster = GetCaster())
|
||||||
caster = GetCaster();
|
|
||||||
if(caster)
|
|
||||||
{
|
{
|
||||||
caster->GetSingleCastAuras().remove(this);
|
caster->GetSingleCastAuras().remove(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3895,7 +3895,7 @@ void Unit::RemoveNotOwnSingleTargetAuras()
|
||||||
if (aura->GetTarget() != this)
|
if (aura->GetTarget() != this)
|
||||||
{
|
{
|
||||||
scAuras.erase(iter); // explicitly remove, instead waiting remove in RemoveAura
|
scAuras.erase(iter); // explicitly remove, instead waiting remove in RemoveAura
|
||||||
aura->GetTarget()->RemoveAura(aura->GetId(),aura->GetEffIndex());
|
aura->GetTarget()->RemoveAura(aura);
|
||||||
iter = scAuras.begin();
|
iter = scAuras.begin();
|
||||||
}
|
}
|
||||||
else
|
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)
|
void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
||||||
{
|
{
|
||||||
Aura* Aur = i->second;
|
Aura* Aur = i->second;
|
||||||
|
|
|
||||||
|
|
@ -1196,6 +1196,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
|
|
||||||
bool AddAura(Aura *aur);
|
bool AddAura(Aura *aur);
|
||||||
|
|
||||||
|
void RemoveAura(Aura* aura);
|
||||||
void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||||
void RemoveAura(uint32 spellId, uint32 effindex, Aura* except = NULL);
|
void RemoveAura(uint32 spellId, uint32 effindex, Aura* except = NULL);
|
||||||
void RemoveSingleSpellAurasFromStack(uint32 spellId);
|
void RemoveSingleSpellAurasFromStack(uint32 spellId);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8235"
|
#define REVISION_NR "8236"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue