aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQAston <none@none>2010-01-30 11:37:39 +0100
committerQAston <none@none>2010-01-30 11:37:39 +0100
commit23f589efa3caf01de0ad04d092e782ef5f349ee6 (patch)
treee95de57b6c8c3f6f60c98485ec4ce21399e178ae
parent7209312044cf1d8b443ba0a6f2216089e50ff44e (diff)
*Fix a crash in CORPSE_MAP_POSITION_RESPONSE handler.
--HG-- branch : trunk
-rw-r--r--src/game/DBCStructure.h10
-rw-r--r--src/game/Map.h7
-rw-r--r--src/game/QueryHandler.cpp14
3 files changed, 18 insertions, 13 deletions
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index 6b736d0f4f7..f07aab090ae 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -1152,6 +1152,16 @@ struct MapEntry
MapID==616 || MapID==595; // Eye Of Eternity, The Culling of Stratholme
}
+ bool GetEntrancePos(int32 &mapid, float &x, float &y) const
+ {
+ if(entrance_map < 0)
+ return false;
+ mapid = entrance_map;
+ x = entrance_x;
+ y = entrance_y;
+ return true;
+ }
+
bool IsContinent() const
{
return MapID == 0 || MapID == 1 || MapID == 530 || MapID == 571;
diff --git a/src/game/Map.h b/src/game/Map.h
index df3a0fbaef1..52bf64cdbe2 100644
--- a/src/game/Map.h
+++ b/src/game/Map.h
@@ -369,12 +369,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
{
if(!i_mapEntry)
return false;
- if(i_mapEntry->entrance_map < 0)
- return false;
- mapid = i_mapEntry->entrance_map;
- x = i_mapEntry->entrance_x;
- y = i_mapEntry->entrance_y;
- return true;
+ return i_mapEntry->GetEntrancePos(mapid, x, y);
}
void AddObjectToRemoveList(WorldObject *obj);
diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp
index 5375e938f56..010fda345bc 100644
--- a/src/game/QueryHandler.cpp
+++ b/src/game/QueryHandler.cpp
@@ -471,17 +471,17 @@ void WorldSession::HandleCorpseMapPositionQuery( WorldPacket & recv_data )
WorldPacket data(CMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 4+4+4+4);
- Map* map = corpse->GetMap();
-
float cx, cy, cz;
- if (map->IsDungeon())
+ int32 mapId = corpse->GetMapId();
+ MapEntry const * corpseMapEntry = sMapStore.LookupEntry(mapId);
+ if (corpseMapEntry->IsDungeon())
{
- int32 mapId;
float mx, my;
- map->GetEntrancePos(mapId, mx, my);
+ bool entranceFound = corpseMapEntry->GetEntrancePos(mapId, mx, my);
+ assert(entranceFound);
- const Map* newMap = MapManager::Instance().CreateBaseMap(mapId);
+ Map const * newMap = MapManager::Instance().CreateBaseMap(mapId);
uint32 zoneId = newMap->GetZoneId(mx, my, 0);
float _mx = mx;
@@ -494,7 +494,7 @@ void WorldSession::HandleCorpseMapPositionQuery( WorldPacket & recv_data )
cx = x - mx;
cy = y - my;
- cz = corpse->GetPositionZ() - map->GetHeight(_mx, _my, MAX_HEIGHT);
+ cz = corpse->GetPositionZ() - newMap->GetHeight(_mx, _my, MAX_HEIGHT);
}
else
{