aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authormegamage <none@none.none>2011-11-28 14:05:25 -0500
committermegamage <none@none.none>2011-11-28 14:05:25 -0500
commit529af3cd092972c2d5204308a5ba573bad8e0b1f (patch)
treedc416a7353c359677807d8871c585ff2627ffccd /src/server/game/Globals/ObjectMgr.cpp
parentcde7ea260eae5c7676411c848131f91e5648ec28 (diff)
Delete obj if it is not successfully added to grid. More to fix.
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 6b0601d9663..6201a932a60 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -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);
}
}