[11222] Move possition setup for Creature and subclases before Create call.

Some called from Create code can req. proper pos setup for creature.
Bad side: But in way how currently code orginized impossible setup excetly position for most
Creature sublasses. So in this part need more work.
This commit is contained in:
VladimirMangos 2011-03-06 12:08:55 +03:00
parent c132e54f73
commit 51b4556c4b
7 changed files with 171 additions and 105 deletions

View file

@ -1230,17 +1230,18 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map)
if (map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, guidlow)))
return false;
if (!Create(guidlow, map, data->phaseMask, data->id, TEAM_NONE, data, eventData))
return false;
// set coordinates before call Create because some code can be depend from correct coordinates values.
Relocate(data->posX, data->posY, data->posZ, data->orientation);
if(!IsPositionValid())
if (!IsPositionValid())
{
sLog.outError("Creature (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY());
return false;
}
if (!Create(guidlow, map, data->phaseMask, data->id, TEAM_NONE, data, eventData))
return false;
m_respawnradius = data->spawndist;
m_respawnDelay = data->spawntimesecs;