Core/Auras: Add some asserions to hunt down reason of a crash in Aura::UpdateTargetMap. Thanks to Shauren for inspiration.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-12-26 00:14:13 +01:00
parent f5492f82b5
commit f4e46db38a
3 changed files with 9 additions and 4 deletions

View File

@@ -1321,7 +1321,7 @@ void GameObject::Use(Unit* user)
if (user->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)user;
Player* player = user->ToPlayer();
Unit* owner = GetOwner();

View File

@@ -3468,6 +3468,9 @@ AuraApplication * Unit::_CreateAuraApplication(Aura * aura, uint8 effMask)
// aura musn't be removed
ASSERT(!aura->IsRemoved());
// aura mustn't be already applied on target
ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");
SpellEntry const* aurSpellInfo = aura->GetSpellProto();
uint32 aurId = aurSpellInfo->Id;

View File

@@ -402,8 +402,8 @@ void Aura::_ApplyForTarget(Unit * target, Unit * caster, AuraApplication * auraA
{
ASSERT(target);
ASSERT(auraApp);
// aura mustn't be already applied
ASSERT (m_applications.find(target->GetGUID()) == m_applications.end());
// aura mustn't be already applied on target
ASSERT (!IsAppliedOnTarget(target->GetGUID()) && "Aura::_ApplyForTarget: aura musn't be already applied on target");
m_applications[target->GetGUID()] = auraApp;
@@ -502,6 +502,9 @@ void Aura::UpdateTargetMap(Unit * caster, bool apply)
// register auras for units
for (std::map<Unit *, uint8>::iterator itr = targets.begin(); itr!= targets.end();)
{
// aura mustn't be already applied on target
ASSERT (!IsAppliedOnTarget(itr->first->GetGUID()) && "Aura::UpdateTargetMap: aura musn't be applied on target");
bool addUnit = true;
// check target immunities
if (itr->first->IsImmunedToSpell(GetSpellProto())
@@ -570,7 +573,6 @@ void Aura::UpdateTargetMap(Unit * caster, bool apply)
// targets have to be registered and not have effect applied yet to use this function
void Aura::_ApplyEffectForTargets(uint8 effIndex)
{
//Unit * caster = GetCaster();
// prepare list of aura targets
UnitList targetList;
for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)