diff options
| author | megamage <none@none> | 2009-07-16 11:49:00 +0800 |
|---|---|---|
| committer | megamage <none@none> | 2009-07-16 11:49:00 +0800 |
| commit | 208087ff6ee592150b1ed387bbc135566a02a359 (patch) | |
| tree | 42b3b460ce2276259e2673bc8b254e0812af1fbb /src/game/Corpse.cpp | |
| parent | 762528c5dd7908de47f2c2a7dcc5e7c95eb79744 (diff) | |
[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
Diffstat (limited to 'src/game/Corpse.cpp')
| -rw-r--r-- | src/game/Corpse.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
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); |
