mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 22:37:02 +00:00
[10915] Restore GameEvent system work after last Map terain rewrite.
This commit is contained in:
parent
d1b0e5b40f
commit
e2a8c3a119
1 changed files with 27 additions and 29 deletions
|
|
@ -568,22 +568,21 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
||||||
sObjectMgr.AddCreatureToGrid(*itr, data);
|
sObjectMgr.AddCreatureToGrid(*itr, data);
|
||||||
|
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid));
|
if (Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid)))
|
||||||
if(!map)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// We use spawn coords to spawn
|
|
||||||
if(!map->Instanceable() && map->IsLoaded(data->posX,data->posY))
|
|
||||||
{
|
{
|
||||||
Creature* pCreature = new Creature;
|
// We use spawn coords to spawn
|
||||||
//DEBUG_LOG("Spawning creature %u",*itr);
|
if (!map->Instanceable() && map->IsLoaded(data->posX,data->posY))
|
||||||
if (!pCreature->LoadFromDB(*itr, map))
|
|
||||||
{
|
{
|
||||||
delete pCreature;
|
Creature* pCreature = new Creature;
|
||||||
}
|
//DEBUG_LOG("Spawning creature %u",*itr);
|
||||||
else
|
if (!pCreature->LoadFromDB(*itr, map))
|
||||||
{
|
{
|
||||||
map->Add(pCreature);
|
delete pCreature;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
map->Add(pCreature);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -617,23 +616,22 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
||||||
|
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
// this base map checked as non-instanced and then only existing
|
// this base map checked as non-instanced and then only existing
|
||||||
Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid));
|
if (Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid)))
|
||||||
if(!map)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
|
||||||
if(!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
|
|
||||||
{
|
{
|
||||||
GameObject* pGameobject = new GameObject;
|
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
||||||
//DEBUG_LOG("Spawning gameobject %u", *itr);
|
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
|
||||||
if (!pGameobject->LoadFromDB(*itr, map))
|
|
||||||
{
|
{
|
||||||
delete pGameobject;
|
GameObject* pGameobject = new GameObject;
|
||||||
}
|
//DEBUG_LOG("Spawning gameobject %u", *itr);
|
||||||
else
|
if (!pGameobject->LoadFromDB(*itr, map))
|
||||||
{
|
{
|
||||||
if(pGameobject->isSpawnedByDefault())
|
delete pGameobject;
|
||||||
map->Add(pGameobject);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(pGameobject->isSpawnedByDefault())
|
||||||
|
map->Add(pGameobject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue