[10915] Restore GameEvent system work after last Map terain rewrite.

This commit is contained in:
VladimirMangos 2010-12-24 15:40:44 +03:00
parent d1b0e5b40f
commit e2a8c3a119

View file

@ -568,12 +568,10 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
sObjectMgr.AddCreatureToGrid(*itr, data);
// Spawn if necessary (loaded grids only)
Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid));
if(!map)
return;
if (Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid)))
{
// We use spawn coords to spawn
if(!map->Instanceable() && map->IsLoaded(data->posX,data->posY))
if (!map->Instanceable() && map->IsLoaded(data->posX,data->posY))
{
Creature* pCreature = new Creature;
//DEBUG_LOG("Spawning creature %u",*itr);
@ -588,6 +586,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
}
}
}
}
if (internal_event_id < 0 || (size_t)internal_event_id >= mGameEventGameobjectGuids.size())
{
@ -617,12 +616,10 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
// Spawn if necessary (loaded grids only)
// this base map checked as non-instanced and then only existing
Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid));
if(!map)
return;
if (Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid)))
{
// We use current coords to unspawn, not spawn coords since creature can have changed grid
if(!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
{
GameObject* pGameobject = new GameObject;
//DEBUG_LOG("Spawning gameobject %u", *itr);
@ -638,6 +635,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
}
}
}
}
if (event_id > 0)
{