aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2018-01-27 21:47:37 +0100
committerjoschiwald <joschiwald.trinity@gmail.com>2018-01-27 23:02:46 +0100
commit6226189a1687e1a2b4fb5a490031c22b5f334dc6 (patch)
treed48fbc4a586203c0c4ae3721697d3428773e9e00 /src/server/game/Globals/ObjectMgr.cpp
parentf963b8a225a70e7007536d5d4787483a2cade978 (diff)
Core/Entities: Created factory methods to create new areatriggers, creatures and gameobjects
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp10
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);
}
}