mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[8753] Next version assert fail at grid load fix.
Old version not work in result wrong guid use for check. Code moved to Creature::LoadFromDB where all data accessable fro proper search.
This commit is contained in:
parent
ddd51cca6d
commit
4284bcc2da
3 changed files with 12 additions and 20 deletions
|
|
@ -1353,7 +1353,17 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
|
|||
}
|
||||
|
||||
m_DBTableGuid = guid;
|
||||
if (map->GetInstanceId() != 0) guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT);
|
||||
if (map->GetInstanceId() == 0)
|
||||
{
|
||||
// Creature can be loaded already in map if grid has been unloaded while creature walk to another grid
|
||||
// FIXME: until creature guids is global and for instances used dynamic generated guids
|
||||
// in instance possible load creature duplicates with same DB guid but different in game guids
|
||||
// This will be until implementing per-map creature guids
|
||||
if (map->GetCreature(MAKE_NEW_GUID(guid,data->id,HIGHGUID_UNIT)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
guid = objmgr.GenerateLowGuid(HIGHGUID_UNIT);
|
||||
|
||||
uint16 team = 0;
|
||||
if(!Create(guid,map,data->phaseMask,data->id,team,data))
|
||||
|
|
|
|||
|
|
@ -104,17 +104,6 @@ template<> void addUnitState(Creature *obj, CellPair const& cell_pair)
|
|||
obj->SetCurrentCell(cell);
|
||||
}
|
||||
|
||||
template<class T> bool alreadyLoaded(Map* /*map*/, uint32 /*guid*/)
|
||||
{
|
||||
// Non creature objects not walk by grids
|
||||
return false;
|
||||
}
|
||||
|
||||
template<> bool alreadyLoaded<Creature>(Map* map, uint32 guid)
|
||||
{
|
||||
return map->GetObjectsStore().find<Creature>(guid,(Creature*)NULL);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* map)
|
||||
{
|
||||
|
|
@ -124,13 +113,6 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &
|
|||
{
|
||||
uint32 guid = *i_guid;
|
||||
|
||||
// Note: this will fully correct work only at non-instanced maps,
|
||||
// at instanced maps will use dynamic selected guid
|
||||
// and then duplicate just will not detected and will be 2 creature with identical DB guid
|
||||
// with some chance
|
||||
if (alreadyLoaded<T>(map,guid))
|
||||
continue; // still loaded in another grid (move from respawn [this] grid early), we not need second copy
|
||||
|
||||
T* obj = new T;
|
||||
//sLog.outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading",table,guid);
|
||||
if(!obj->LoadFromDB(guid, map))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8752"
|
||||
#define REVISION_NR "8753"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue