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
+11 -2
View File
@@ -1454,7 +1454,11 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
data.go_state = 1;
*/
// Add to world, so it can be later looked up from HashMapHolder
map->AddToMap(go);
if (!map->AddToMap(go))
{
delete go;
return false;
}
m_BgObjects[type] = go->GetGUID();
return true;
}
@@ -1557,7 +1561,12 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
map->AddToMap(creature);
if (!map->AddToMap(creature))
{
delete creature;
return NULL;
}
m_BgCreatures[type] = creature->GetGUID();
if (respawntime)