mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[11168] Use MapPersistentState for access to Pool System dynamic data.
* Direct store pool system dynamic data in sPoolMgr replaced by shared pool system data object (for all non instanceable maps) into WorldPersistentState, and own copies of pool system data object in DungeonPersistentState/BattlegroundPersistentState. This let have pools with object at many non-instanceable maps, and single map pools with unique state for each instance. * Avoid direct global grid data modify from pool system, and use for this also recently added local for MapPersistentState grid spawn data. * Implemented proper API for update pool system data in MapPersistentStates from GameEvent system. * Initialize pool system state at MapPersistendState creating. For shared pool system state for non-instanceable maps initilized at first map state creating. Now pool system propertly work in instance also!
This commit is contained in:
parent
9e14a0529d
commit
8feaf211f1
14 changed files with 299 additions and 185 deletions
|
|
@ -593,6 +593,15 @@ uint32 GameEventMgr::Initialize() // return the next e
|
|||
return delay;
|
||||
}
|
||||
|
||||
void GameEventMgr::Initialize( MapPersistentState* state )
|
||||
{
|
||||
// At map persistent state creating need only apply pool spawn modifications
|
||||
// other data is global and will be auto-apply
|
||||
for(GameEventMgr::ActiveEvents::const_iterator event_itr = m_ActiveEvents.begin(); event_itr != m_ActiveEvents.end(); ++event_itr)
|
||||
for (IdList::iterator pool_itr = mGameEventSpawnPoolIds[*event_itr].begin(); pool_itr != mGameEventSpawnPoolIds[*event_itr].end(); ++pool_itr)
|
||||
sPoolMgr.InitSpawnPool(*state, *pool_itr);
|
||||
}
|
||||
|
||||
// return the next event delay in ms
|
||||
uint32 GameEventMgr::Update(ActiveEvents const* activeAtShutdown /*= NULL*/)
|
||||
{
|
||||
|
|
@ -703,7 +712,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
|||
{
|
||||
// will have chance at next pool update
|
||||
sPoolMgr.SetExcludeObject<Creature>(pool_id, *itr, false);
|
||||
sPoolMgr.UpdatePool<Creature>(pool_id);
|
||||
sPoolMgr.UpdatePoolInMaps<Creature>(pool_id);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -733,7 +742,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
|||
{
|
||||
// will have chance at next pool update
|
||||
sPoolMgr.SetExcludeObject<GameObject>(pool_id, *itr, false);
|
||||
sPoolMgr.UpdatePool<GameObject>(pool_id);
|
||||
sPoolMgr.UpdatePoolInMaps<GameObject>(pool_id);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -753,7 +762,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
|
|||
}
|
||||
|
||||
for (IdList::iterator itr = mGameEventSpawnPoolIds[event_id].begin();itr != mGameEventSpawnPoolIds[event_id].end();++itr)
|
||||
sPoolMgr.SpawnPool(*itr, true);
|
||||
sPoolMgr.SpawnPoolInMaps(*itr, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -778,7 +787,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
|||
if (uint16 poolid = sPoolMgr.IsPartOfAPool<Creature>(*itr))
|
||||
{
|
||||
sPoolMgr.SetExcludeObject<Creature>(poolid, *itr, true);
|
||||
sPoolMgr.UpdatePool<Creature>(poolid, *itr);
|
||||
sPoolMgr.UpdatePoolInMaps<Creature>(poolid, *itr);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -808,7 +817,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
|||
if (uint16 poolid = sPoolMgr.IsPartOfAPool<GameObject>(*itr))
|
||||
{
|
||||
sPoolMgr.SetExcludeObject<GameObject>(poolid, *itr, true);
|
||||
sPoolMgr.UpdatePool<GameObject>(poolid, *itr);
|
||||
sPoolMgr.UpdatePoolInMaps<GameObject>(poolid, *itr);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -831,7 +840,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
|
|||
|
||||
for (IdList::iterator itr = mGameEventSpawnPoolIds[event_id].begin();itr != mGameEventSpawnPoolIds[event_id].end();++itr)
|
||||
{
|
||||
sPoolMgr.DespawnPool(*itr);
|
||||
sPoolMgr.DespawnPoolInMaps(*itr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue