mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[10898] Fix for pool system problems after map rewrite.
This commit is contained in:
parent
1d84a8de1d
commit
ca095e27a8
2 changed files with 63 additions and 56 deletions
|
|
@ -367,13 +367,16 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj, bool instantly)
|
||||||
{
|
{
|
||||||
sObjectMgr.AddCreatureToGrid(obj->guid, data);
|
sObjectMgr.AddCreatureToGrid(obj->guid, data);
|
||||||
|
|
||||||
|
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||||
|
|
||||||
|
// temporary limit pool system full power work to continents
|
||||||
|
if (mapEntry && !mapEntry->Instanceable())
|
||||||
|
{
|
||||||
// Spawn if necessary (loaded grids only)
|
// Spawn if necessary (loaded grids only)
|
||||||
Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid));
|
Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid));
|
||||||
if(!map)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// We use spawn coords to spawn (avoid work for instances until implemented support)
|
// We use spawn coords to spawn
|
||||||
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
|
if (map && map->IsLoaded(data->posX, data->posY))
|
||||||
{
|
{
|
||||||
Creature* pCreature = new Creature;
|
Creature* pCreature = new Creature;
|
||||||
//DEBUG_LOG("Spawning creature %u",obj->guid);
|
//DEBUG_LOG("Spawning creature %u",obj->guid);
|
||||||
|
|
@ -395,9 +398,10 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj, bool instantly)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for not loaded grid just update respawn time (avoid work for instances until implemented support)
|
// for not loaded grid just update respawn time (avoid work for instances until implemented support)
|
||||||
else if(!map->Instanceable() && !instantly)
|
else if(!instantly)
|
||||||
{
|
{
|
||||||
sObjectMgr.SaveCreatureRespawnTime(obj->guid,map->GetInstanceId(),time(NULL) + data->spawntimesecs);
|
sObjectMgr.SaveCreatureRespawnTime(obj->guid, 0 /*map->GetInstanceId()*/, time(NULL) + data->spawntimesecs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -409,15 +413,17 @@ void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj, bool instantly)
|
||||||
if (GameObjectData const* data = sObjectMgr.GetGOData(obj->guid))
|
if (GameObjectData const* data = sObjectMgr.GetGOData(obj->guid))
|
||||||
{
|
{
|
||||||
sObjectMgr.AddGameobjectToGrid(obj->guid, data);
|
sObjectMgr.AddGameobjectToGrid(obj->guid, data);
|
||||||
// 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;
|
|
||||||
|
|
||||||
// We use current coords to unspawn, not spawn coords since creature can have changed grid
|
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
|
||||||
// (avoid work for instances until implemented support)
|
|
||||||
if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY))
|
// temporary limit pool system full power work to continents
|
||||||
|
if (mapEntry && !mapEntry->Instanceable())
|
||||||
|
{
|
||||||
|
// Spawn if necessary (loaded grids only)
|
||||||
|
Map* map = const_cast<Map*>(sMapMgr.FindMap(data->mapid));
|
||||||
|
|
||||||
|
// We use spawn coords to spawn
|
||||||
|
if (map && map->IsLoaded(data->posX, data->posY))
|
||||||
{
|
{
|
||||||
GameObject* pGameobject = new GameObject;
|
GameObject* pGameobject = new GameObject;
|
||||||
//DEBUG_LOG("Spawning gameobject %u", obj->guid);
|
//DEBUG_LOG("Spawning gameobject %u", obj->guid);
|
||||||
|
|
@ -442,11 +448,12 @@ void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj, bool instantly)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for not loaded grid just update respawn time (avoid work for instances until implemented support)
|
// for not loaded grid just update respawn time (avoid work for instances until implemented support)
|
||||||
else if(!map->Instanceable() && !instantly)
|
else if(!instantly)
|
||||||
{
|
{
|
||||||
// for spawned by default object only
|
// for spawned by default object only
|
||||||
if (data->spawntimesecs >= 0)
|
if (data->spawntimesecs >= 0)
|
||||||
sObjectMgr.SaveGORespawnTime(obj->guid,map->GetInstanceId(),time(NULL) + data->spawntimesecs);
|
sObjectMgr.SaveGORespawnTime(obj->guid, 0 /*map->GetInstanceId()*/, time(NULL) + data->spawntimesecs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10897"
|
#define REVISION_NR "10898"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue