Delete obj if it is not successfully added to grid. More to fix.
This commit is contained in:
@@ -1630,13 +1630,12 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
|
||||
if (!map->Instanceable() && map->IsGridLoaded(x, y))
|
||||
{
|
||||
GameObject* go = new GameObject;
|
||||
if (!go->LoadFromDB(guid, map))
|
||||
if (!go->LoadGameObjectFromDB(guid, map))
|
||||
{
|
||||
sLog->outError("AddGOData: cannot add gameobject entry %u to map", entry);
|
||||
delete go;
|
||||
return 0;
|
||||
}
|
||||
map->AddToMap(go);
|
||||
}
|
||||
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "AddGOData: dbguid %u entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o);
|
||||
@@ -1666,13 +1665,12 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
|
||||
if (!map->Instanceable() && map->IsGridLoaded(data.posX, data.posY))
|
||||
{
|
||||
Creature* creature = new Creature;
|
||||
if (!creature->LoadFromDB(guid, map))
|
||||
if (!creature->LoadCreatureFromDB(guid, map))
|
||||
{
|
||||
sLog->outError("AddCreature: cannot add creature entry %u to map", guid);
|
||||
delete creature;
|
||||
return false;
|
||||
}
|
||||
map->AddToMap(creature);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -1719,13 +1717,12 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
|
||||
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
||||
{
|
||||
Creature* creature = new Creature;
|
||||
if (!creature->LoadFromDB(guid, map))
|
||||
if (!creature->LoadCreatureFromDB(guid, map))
|
||||
{
|
||||
sLog->outError("AddCreature: cannot add creature entry %u to map", entry);
|
||||
delete creature;
|
||||
return 0;
|
||||
}
|
||||
map->AddToMap(creature);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user