diff options
author | QAston <none@none> | 2010-12-26 00:14:13 +0100 |
---|---|---|
committer | QAston <none@none> | 2010-12-26 00:14:13 +0100 |
commit | f4e46db38a110c62013740df6e3feac28d22576c (patch) | |
tree | 8489855719d239cde0e23a2960f81559ab0d98dc /src | |
parent | f5492f82b56c7182f7cb8fbba56acd9a2fce4e01 (diff) |
Core/Auras: Add some asserions to hunt down reason of a crash in Aura::UpdateTargetMap. Thanks to Shauren for inspiration.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/GameObject/GameObject.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 3 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.cpp | 8 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 73499dad5bb..809f394a2f8 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -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(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ab0dca5510f..226baa73ab5 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index aada5edc5fc..4a7ec595f28 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -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) |