Delete obj if it is not successfully added to grid. More to fix.

This commit is contained in:
megamage
2011-11-28 14:05:25 -05:00
parent cde7ea260e
commit 529af3cd09
12 changed files with 79 additions and 42 deletions
+3 -4
View File
@@ -1176,10 +1176,8 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
{
Creature* creature = new Creature;
//sLog->outDebug("Spawning creature %u", *itr);
if (!creature->LoadFromDB(*itr, map))
if (!creature->LoadCreatureFromDB(*itr, map))
delete creature;
else
map->AddToMap(creature);
}
}
}
@@ -1205,7 +1203,8 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
{
GameObject* pGameobject = new GameObject;
//sLog->outDebug("Spawning gameobject %u", *itr);
if (!pGameobject->LoadFromDB(*itr, map))
//TODO: find out when it is add to map
if (!pGameobject->LoadGameObjectFromDB(*itr, map, false))
delete pGameobject;
else
{