From 8e7f30eb6199392b14e038d9adcb1a885f792b92 Mon Sep 17 00:00:00 2001 From: QAston Date: Mon, 26 Jul 2010 22:57:25 +0200 Subject: [PATCH] *Add debug log to trac reason of a crash in Spell::DoAllEffectOnTarget. --HG-- branch : trunk --- src/server/game/Entities/Unit/Unit.cpp | 2 ++ src/server/game/Spells/Spell.cpp | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4696300e41..29dad93368 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16637,6 +16637,8 @@ void Unit::OutDebugInfo() const sLog.outString("GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName()); sLog.outString("OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID()); sLog.outString("In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask); + if (IsInWorld()) + sLog.outString("Mapid %u", GetMapId()); sLog.outStringInLine("Summon Slot: "); for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index dd20bb638d..ca39667441 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1046,6 +1046,23 @@ void Spell::AddItemTarget(Item* pitem, uint32 effIndex) void Spell::DoAllEffectOnTarget(TargetInfo *target) { + // invalid pointer, log debug info to trac the reason + if (target && target < ((TargetInfo*)1024)) + { + sLog.outString("Spell::DoAllEffectOnTarget CRASH! - debug info:"); + sLog.outString("Caster:"); + m_caster->OutDebugInfo(); + if (m_targets.getUnitTarget()) + { + sLog.outString("Unit target:"); + m_targets.getUnitTarget()->OutDebugInfo(); + } + sLog.outString("SpellId: %d", m_spellInfo->Id); + sLog.outString("SpellTargetMap:"); + for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + sLog.outStringInLine("guid:%u, effmask:%u, ", ihit->targetGUID, ihit->effectMask); + ASSERT(false); + } if (!target || target->processed) return; @@ -5626,7 +5643,7 @@ SpellCastResult Spell::CheckCasterAuras() const else if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DISPEL_IMMUNITY) dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i])); } - //immune movement impairment and loss of control + // immune movement impairment and loss of control if (m_spellInfo->Id == 42292 || m_spellInfo->Id == 59752) mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; }