diff options
Diffstat (limited to 'src/server/game/Pools/PoolMgr.cpp')
-rw-r--r-- | src/server/game/Pools/PoolMgr.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index b3cdbfae513..8f5f8b14da3 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -389,15 +389,7 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj) Map* map = sMapMgr->CreateBaseMap(data->mapid); // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) - { - Creature* creature = new Creature(); - //TC_LOG_DEBUG("pool", "Spawning creature %u", guid); - if (!creature->LoadCreatureFromDB(obj->guid, map)) - { - delete creature; - return; - } - } + Creature::CreateCreatureFromDB(obj->guid, map); } } @@ -414,17 +406,13 @@ void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj) // We use current coords to unspawn, not spawn coords since creature can have changed grid if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { - GameObject* pGameobject = new GameObject; - //TC_LOG_DEBUG("pool", "Spawning gameobject %u", guid); - if (!pGameobject->LoadGameObjectFromDB(obj->guid, map, false)) + if (GameObject* go = GameObject::CreateGameObjectFromDB(obj->guid, map, false)) { - delete pGameobject; - return; - } - else - { - if (pGameobject->isSpawnedByDefault()) - map->AddToMap(pGameobject); + if (go->isSpawnedByDefault()) + { + if (!map->AddToMap(go)) + delete go; + } } } } |