From b1183c931b1dcbffa83d860c32d1afa308bb03e6 Mon Sep 17 00:00:00 2001 From: QAston Date: Mon, 20 Jul 2009 16:59:15 +0200 Subject: [PATCH] *Use map pointer of killed creature instead of player pointer to prevent crash in case killer is not in world. --HG-- branch : trunk --- src/game/Formulas.h | 2 +- src/game/Unit.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/Formulas.h b/src/game/Formulas.h index 041c0621c7..2ec175f95b 100644 --- a/src/game/Formulas.h +++ b/src/game/Formulas.h @@ -117,7 +117,7 @@ namespace Trinity (((Creature*)u)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) )) return 0; - uint32 xp_gain= BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(pl->GetMapId(),pl->GetZoneId())); + uint32 xp_gain= BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(),u->GetZoneId())); if( xp_gain == 0 ) return 0; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 66a06135ec..24128fc85c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -13668,6 +13668,7 @@ void Unit::SetToNotify() void Unit::Kill(Unit *pVictim, bool durabilityLoss) { + assert(pVictim->IsInWorld() && pVictim->FindMap()); // Prevent killing unit twice (and giving reward from kill twice) if (!pVictim->GetHealth()) return;