Core/Auras: Add some assertions to make sure that AuraEffects are not added twice to UnitAuraEffect containers.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-12-19 19:43:53 +01:00
parent 60ce3fdbd2
commit 251f7f2121
+8 -4
View File
@@ -147,6 +147,7 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
if (apply) if (apply)
{ {
ASSERT(!(m_flags & (1<<effIndex)));
m_flags |= 1<<effIndex; m_flags |= 1<<effIndex;
m_flags |=_CheckPositive(caster) ? AFLAG_POSITIVE : AFLAG_NEGATIVE; m_flags |=_CheckPositive(caster) ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
GetTarget()->_HandleAuraEffect(aurEff, true); GetTarget()->_HandleAuraEffect(aurEff, true);
@@ -154,6 +155,7 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
} }
else else
{ {
ASSERT(m_flags & (1<<effIndex));
m_flags &= ~(1<<effIndex); m_flags &= ~(1<<effIndex);
m_flags |=_CheckPositive(caster) ? AFLAG_POSITIVE : AFLAG_NEGATIVE; m_flags |=_CheckPositive(caster) ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
@@ -423,17 +425,19 @@ void Aura::_UnapplyForTarget(Unit * target, Unit * caster, AuraApplication * aur
ASSERT(auraApp); ASSERT(auraApp);
ApplicationMap::iterator itr = m_applications.find(target->GetGUID()); ApplicationMap::iterator itr = m_applications.find(target->GetGUID());
// TODO: Figure out why this happens.
// TODO: Figure out why this happens
if (itr == m_applications.end()) if (itr == m_applications.end())
{ {
sLog.outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!", sLog.outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellProto()->Id); target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellProto()->Id);
ASSERT(false);
} }
else
m_applications.erase(itr);
// aura has to be already applied // aura has to be already applied
//ASSERT(itr->second == auraApp); ASSERT(itr->second == auraApp);
m_applications.erase(itr);
m_removedApplications.push_back(auraApp); m_removedApplications.push_back(auraApp);
// reset cooldown state for spells // reset cooldown state for spells