diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
| -rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index e17286abc18..d030149640d 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2132,11 +2132,10 @@ ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, fl // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(x, y)) { - GameObject* go = new GameObject; - if (!go->LoadGameObjectFromDB(guid, map)) + GameObject* go = GameObject::CreateGameObjectFromDB(guid, map); + if (!go) { TC_LOG_ERROR("misc", "AddGOData: cannot add gameobject entry %u to map", entry); - delete go; return UI64LIT(0); } } @@ -2185,11 +2184,10 @@ ObjectGuid::LowType ObjectMgr::AddCreatureData(uint32 entry, uint32 mapId, float // We use spawn coords to spawn if (!map->Instanceable() && !map->IsRemovalGrid(x, y)) { - Creature* creature = new Creature(); - if (!creature->LoadCreatureFromDB(guid, map)) + Creature* creature = Creature::CreateCreatureFromDB(guid, map); + if (!creature) { TC_LOG_ERROR("misc", "AddCreature: Cannot add creature entry %u to map", entry); - delete creature; return UI64LIT(0); } } |
