*Use safer method to check if any auras were removed while aura update
--HG-- branch : trunk
This commit is contained in:
+24
-20
@@ -79,7 +79,7 @@ static bool procPrepared = InitTriggerAuraData();
|
|||||||
Unit::Unit()
|
Unit::Unit()
|
||||||
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this)
|
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this)
|
||||||
, m_IsInNotifyList(false), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false)
|
, m_IsInNotifyList(false), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false)
|
||||||
, i_AI(NULL), i_disabledAI(NULL)
|
, i_AI(NULL), i_disabledAI(NULL), m_removedAurasCount(0)
|
||||||
{
|
{
|
||||||
m_objectType |= TYPEMASK_UNIT;
|
m_objectType |= TYPEMASK_UNIT;
|
||||||
m_objectTypeId = TYPEID_UNIT;
|
m_objectTypeId = TYPEID_UNIT;
|
||||||
@@ -461,9 +461,9 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
|
|||||||
++iter;
|
++iter;
|
||||||
if ((aur->GetSpellProto()->AuraInterruptFlags & flag) && (!except || aur->GetId() != except))
|
if ((aur->GetSpellProto()->AuraInterruptFlags & flag) && (!except || aur->GetId() != except))
|
||||||
{
|
{
|
||||||
uint32 removedAuras = m_removedAuras.size();
|
uint32 removedAuras = m_removedAurasCount;
|
||||||
RemoveAura(aur, AURA_REMOVE_BY_EXPIRE);
|
RemoveAura(aur, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||||
if (removedAuras+1<m_removedAuras.size())
|
if (removedAuras+1 < m_removedAurasCount)
|
||||||
iter=m_interruptableAuras.begin();
|
iter=m_interruptableAuras.begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -505,9 +505,9 @@ void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell)
|
|||||||
++iter;
|
++iter;
|
||||||
if ((!spell || aur->GetId() != spell) && roll_chance_f(chance))
|
if ((!spell || aur->GetId() != spell) && roll_chance_f(chance))
|
||||||
{
|
{
|
||||||
uint32 removedAuras = m_removedAuras.size();
|
uint32 removedAuras = m_removedAurasCount;
|
||||||
RemoveAura(aur);
|
RemoveAura(aur, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||||
if (removedAuras+1<m_removedAuras.size())
|
if (removedAuras+1 < m_removedAurasCount)
|
||||||
iter=m_ccAuras.begin();
|
iter=m_ccAuras.begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1636,7 +1636,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||||||
|
|
||||||
// victim's damage shield
|
// victim's damage shield
|
||||||
std::set<AuraEffect*> alreadyDone;
|
std::set<AuraEffect*> alreadyDone;
|
||||||
uint32 removedAuras = pVictim->m_removedAuras.size();
|
uint32 removedAuras = pVictim->m_removedAurasCount;
|
||||||
AuraEffectList const& vDamageShields = pVictim->GetAurasByType(SPELL_AURA_DAMAGE_SHIELD);
|
AuraEffectList const& vDamageShields = pVictim->GetAurasByType(SPELL_AURA_DAMAGE_SHIELD);
|
||||||
for(AuraEffectList::const_iterator i = vDamageShields.begin(), next = vDamageShields.begin(); i != vDamageShields.end(); i = next)
|
for(AuraEffectList::const_iterator i = vDamageShields.begin(), next = vDamageShields.begin(); i != vDamageShields.end(); i = next)
|
||||||
{
|
{
|
||||||
@@ -1665,9 +1665,9 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||||||
|
|
||||||
pVictim->DealDamage(this, damage, 0, SPELL_DIRECT_DAMAGE, GetSpellSchoolMask(spellProto), spellProto, true);
|
pVictim->DealDamage(this, damage, 0, SPELL_DIRECT_DAMAGE, GetSpellSchoolMask(spellProto), spellProto, true);
|
||||||
|
|
||||||
if (pVictim->m_removedAuras.size() > removedAuras)
|
if (pVictim->m_removedAurasCount > removedAuras)
|
||||||
{
|
{
|
||||||
removedAuras = pVictim->m_removedAuras.size();
|
removedAuras = pVictim->m_removedAurasCount;
|
||||||
next = vDamageShields.begin();
|
next = vDamageShields.begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2060,9 +2060,9 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||||||
++i;
|
++i;
|
||||||
if (auraeff->GetAmount()<=0)
|
if (auraeff->GetAmount()<=0)
|
||||||
{
|
{
|
||||||
uint32 removedAuras = pVictim->m_removedAuras.size();
|
uint32 removedAuras = pVictim->m_removedAurasCount;
|
||||||
pVictim->RemoveAura(aura, AURA_REMOVE_BY_ENEMY_SPELL);
|
pVictim->RemoveAura(aura, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||||
if (removedAuras+1<pVictim->m_removedAuras.size())
|
if (removedAuras+1<pVictim->m_removedAurasCount)
|
||||||
i=vSchoolAbsorb.begin();
|
i=vSchoolAbsorb.begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3267,12 +3267,15 @@ void Unit::_UpdateSpells( uint32 time )
|
|||||||
|
|
||||||
aur->SetUpdated(true);
|
aur->SetUpdated(true);
|
||||||
|
|
||||||
uint32 removedAuras = m_removedAuras.size();
|
m_removedAurasCount = 0;
|
||||||
aur->Update( time );
|
aur->Update( time );
|
||||||
|
|
||||||
// several auras can be deleted due to update
|
// several auras can be deleted due to update
|
||||||
if(removedAuras < m_removedAuras.size())
|
if(m_removedAurasCount)
|
||||||
|
{
|
||||||
|
m_removedAurasCount = 0;
|
||||||
i = m_Auras.begin();
|
i = m_Auras.begin();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@@ -4025,9 +4028,9 @@ void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura * except
|
|||||||
++iter;
|
++iter;
|
||||||
if (aur != except && (!casterGUID || aur->GetCasterGUID()==casterGUID))
|
if (aur != except && (!casterGUID || aur->GetCasterGUID()==casterGUID))
|
||||||
{
|
{
|
||||||
uint32 removedAuras = m_removedAuras.size();
|
uint32 removedAuras = m_removedAurasCount;
|
||||||
RemoveAura(aur);
|
RemoveAura(aur);
|
||||||
if (removedAuras+1<m_removedAuras.size())
|
if (removedAuras+1< m_removedAurasCount)
|
||||||
iter=m_modAuras[auraType].begin();
|
iter=m_modAuras[auraType].begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4042,9 +4045,9 @@ void Unit::RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell)
|
|||||||
++iter;
|
++iter;
|
||||||
if (GetDispelChance(aur->GetCaster(), aur->GetId()))
|
if (GetDispelChance(aur->GetCaster(), aur->GetId()))
|
||||||
{
|
{
|
||||||
uint32 removedAuras = m_removedAuras.size();
|
uint32 removedAuras = m_removedAurasCount;
|
||||||
RemoveAura(aur, AURA_REMOVE_BY_ENEMY_SPELL);
|
RemoveAura(aur, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||||
if (removedAuras+1<m_removedAuras.size())
|
if (removedAuras+1<m_removedAurasCount)
|
||||||
iter=m_modAuras[auraType].begin();
|
iter=m_modAuras[auraType].begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4069,9 +4072,9 @@ void Unit::RemoveNotOwnSingleTargetAuras()
|
|||||||
++iter;
|
++iter;
|
||||||
if (aur->GetTarget()!=this)
|
if (aur->GetTarget()!=this)
|
||||||
{
|
{
|
||||||
uint32 removedAuras = m_removedAuras.size();
|
uint32 removedAuras = m_removedAurasCount;
|
||||||
aur->GetTarget()->RemoveAura(aur->GetId(),aur->GetCasterGUID());
|
aur->GetTarget()->RemoveAura(aur->GetId(),aur->GetCasterGUID());
|
||||||
if (removedAuras+1<m_removedAuras.size())
|
if (removedAuras+1<m_removedAurasCount)
|
||||||
iter=scAuras.begin();
|
iter=scAuras.begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4084,6 +4087,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
// some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura
|
// some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura
|
||||||
// remove aura from list before to prevent deleting it before
|
// remove aura from list before to prevent deleting it before
|
||||||
m_Auras.erase(i);
|
m_Auras.erase(i);
|
||||||
|
m_removedAurasCount += 1;
|
||||||
|
|
||||||
Aur->UnregisterSingleCastAura();
|
Aur->UnregisterSingleCastAura();
|
||||||
|
|
||||||
|
|||||||
@@ -1582,6 +1582,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
DeathState m_deathState;
|
DeathState m_deathState;
|
||||||
|
|
||||||
AuraMap m_Auras;
|
AuraMap m_Auras;
|
||||||
|
uint32 m_removedAurasCount;
|
||||||
|
|
||||||
typedef std::list<uint64> DynObjectGUIDs;
|
typedef std::list<uint64> DynObjectGUIDs;
|
||||||
DynObjectGUIDs m_dynObjGUIDs;
|
DynObjectGUIDs m_dynObjGUIDs;
|
||||||
|
|||||||
Reference in New Issue
Block a user