Delete obj if it is not successfully added to grid. More to fix.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user