From 07394d45da83e6e98ef1d6fe1af573a986deeb25 Mon Sep 17 00:00:00 2001 From: Wyk3d Date: Mon, 29 Dec 2008 21:16:12 +0200 Subject: [PATCH] [6977] Fixed a crash caused by incorrect use of GetMap for corpses in other maps, and another one caused by SelectHostilTarget failing to notice the target is not in world, due to a fauly InSameMap check. --- src/game/Object.h | 2 +- src/game/QueryHandler.cpp | 2 +- src/shared/revision_nr.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/Object.h b/src/game/Object.h index 6abd05203..9ecbf7b1d 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -416,7 +416,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object float GetDistance2d(const WorldObject* obj) const; float GetDistance2d(const float x, const float y) const; float GetDistanceZ(const WorldObject* obj) const; - bool IsInMap(const WorldObject* obj) const { return GetMapId()==obj->GetMapId() && GetInstanceId()==obj->GetInstanceId(); } + bool IsInMap(const WorldObject* obj) const { return IsInWorld() && obj->IsInWorld() && GetMapId()==obj->GetMapId() && GetInstanceId()==obj->GetInstanceId(); } bool IsWithinDistInMap(const WorldObject* obj, const float dist2compare, const bool is3D = true) const; bool IsWithinLOS(const float x, const float y, const float z ) const; bool IsWithinLOSInMap(const WorldObject* obj) const; diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 08f4a4db7..a24ddb3a9 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -289,7 +289,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) float z = corpse->GetPositionZ(); int32 corpsemapid = _player->GetMapId(); - if(Map *map = corpse->GetMap()) + if(Map *map = MapManager::Instance().FindMap(corpse->GetMapId(), corpse->GetInstanceId())) { if(map->IsDungeon()) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e004c22da..ceeadb6e7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "6976" + #define REVISION_NR "6977" #endif // __REVISION_NR_H__