From 208087ff6ee592150b1ed387bbc135566a02a359 Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 16 Jul 2009 11:49:00 +0800 Subject: [8182] Store and use Map* pointer in WorldObject instead map ids for speedup Author: Ambal Also some code logic cleanups. Changes let make more cleanups in base map access and other places, but this chnages not inlcuded in patch. *This patch may cause crash. --HG-- branch : trunk --- src/game/Corpse.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/game/Corpse.cpp') diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 9fe54be1bec..ea8ad57c910 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -74,12 +74,15 @@ bool Corpse::Create( uint32 guidlow ) bool Corpse::Create( uint32 guidlow, Player *owner) { - SetInstanceId(owner->GetInstanceId()); - - WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetMapId(), owner->GetPhaseMask()); + ASSERT(owner); + WorldObject::_Create(guidlow, HIGHGUID_CORPSE, owner->GetPhaseMask()); Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation()); + //we need to assign owner's map for corpse + //in other way we will get a crash in Corpse::SaveToDB() + SetMap(owner->GetMap()); + if(!IsPositionValid()) { sLog.outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)", @@ -209,8 +212,8 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields) SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_CORPSE)); // place - SetInstanceId(instanceid); - SetMapId(mapid); + SetLocationInstanceId(instanceid); + SetLocationMapId(mapid); SetPhaseMask(phaseMask, false); Relocate(positionX, positionY, positionZ, ort); -- cgit v1.2.3