*Store mapId in Corpse class for access to corpse when grid containing them is unloaded and map pointer is unloaded leading to crash.
--HG-- branch : trunk
This commit is contained in:
@@ -39,6 +39,8 @@ Corpse::Corpse(CorpseType type) : WorldObject()
|
|||||||
|
|
||||||
m_type = type;
|
m_type = type;
|
||||||
|
|
||||||
|
m_mapId = 0;
|
||||||
|
|
||||||
m_time = time(NULL);
|
m_time = time(NULL);
|
||||||
|
|
||||||
lootForBody = false;
|
lootForBody = false;
|
||||||
@@ -198,6 +200,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields, uint32 & mapId, uint32 & in
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapId = fields[4].GetUInt32();
|
mapId = fields[4].GetUInt32();
|
||||||
|
SetMapId(mapId);
|
||||||
instanceId = fields[8].GetUInt32();
|
instanceId = fields[8].GetUInt32();
|
||||||
|
|
||||||
m_time = time_t(fields[6].GetUInt64());
|
m_time = time_t(fields[6].GetUInt64());
|
||||||
|
|||||||
@@ -67,6 +67,11 @@ class Corpse : public WorldObject
|
|||||||
void DeleteBonesFromWorld();
|
void DeleteBonesFromWorld();
|
||||||
void DeleteFromDB();
|
void DeleteFromDB();
|
||||||
|
|
||||||
|
void SetMap (Map * map) {WorldObject::SetMap(map); m_mapId = map->GetId();}
|
||||||
|
// Used to check object existence in unloaded grids
|
||||||
|
uint32 GetMapId() const {return m_mapId;}
|
||||||
|
void SetMapId (uint32 id) {m_mapId = id;}
|
||||||
|
|
||||||
uint64 const& GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
|
uint64 const& GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
|
||||||
|
|
||||||
time_t const& GetGhostTime() const { return m_time; }
|
time_t const& GetGhostTime() const { return m_time; }
|
||||||
@@ -95,6 +100,7 @@ class Corpse : public WorldObject
|
|||||||
CorpseType m_type;
|
CorpseType m_type;
|
||||||
time_t m_time;
|
time_t m_time;
|
||||||
GridPair m_grid; // gride for corpse position for fast search
|
GridPair m_grid; // gride for corpse position for fast search
|
||||||
|
uint32 m_mapId; // map id for fast corpse check at packet requests and in other situations with unloaded map of corpse.
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -439,7 +439,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object
|
|||||||
|
|
||||||
void GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z ) const;
|
void GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z ) const;
|
||||||
|
|
||||||
uint32 GetMapId() const { return m_currMap ? m_currMap->GetId() : 0; }
|
virtual uint32 GetMapId() const { return m_currMap ? m_currMap->GetId() : 0; }
|
||||||
uint32 GetInstanceId() const { return m_currMap ? m_currMap->GetInstanceId() : 0; }
|
uint32 GetInstanceId() const { return m_currMap ? m_currMap->GetInstanceId() : 0; }
|
||||||
|
|
||||||
virtual void SetPhaseMask(uint32 newPhaseMask, bool update);
|
virtual void SetPhaseMask(uint32 newPhaseMask, bool update);
|
||||||
|
|||||||
Reference in New Issue
Block a user