mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10363] More wide use ObjectGuid in way remove MAKE_NEW_GUID uses.
Also * Fixed some amount wrong uses low guids as full player guids. * Add private without body ObjectGuid(uint32 const&) for catch wrong assigns low guids to ObjectGuid. In some cases need assign "0" guid, then use ObjectGuid() instead. * Fixed .pdump commands work.
This commit is contained in:
parent
db7db6382a
commit
5f44c4da21
41 changed files with 369 additions and 323 deletions
|
|
@ -1183,31 +1183,31 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 team, const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Creature::LoadFromDB(uint32 guid, Map *map)
|
||||
bool Creature::LoadFromDB(uint32 guidlow, Map *map)
|
||||
{
|
||||
CreatureData const* data = sObjectMgr.GetCreatureData(guid);
|
||||
CreatureData const* data = sObjectMgr.GetCreatureData(guidlow);
|
||||
|
||||
if(!data)
|
||||
{
|
||||
sLog.outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ",guid);
|
||||
sLog.outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ", guidlow);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_DBTableGuid = guid;
|
||||
m_DBTableGuid = guidlow;
|
||||
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)))
|
||||
if (map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, guidlow)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
guid = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT);
|
||||
guidlow = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT);
|
||||
|
||||
uint16 team = 0;
|
||||
if(!Create(guid, map, data->phaseMask, data->id, team, data))
|
||||
if (!Create(guidlow, map, data->phaseMask, data->id, team, data))
|
||||
return false;
|
||||
|
||||
Relocate(data->posX, data->posY, data->posZ, data->orientation);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue