mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +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
|
|
@ -30,6 +30,7 @@
|
|||
#include "GridNotifiersImpl.h"
|
||||
#include "Transports.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "World.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceData.h"
|
||||
|
|
@ -40,7 +41,6 @@ INSTANTIATE_SINGLETON_1( MapPersistentStateManager );
|
|||
static uint32 resetEventTypeDelay[MAX_RESET_EVENT_TYPE] = { 0, 3600, 900, 300, 60 };
|
||||
|
||||
//== MapPersistentState functions ==========================
|
||||
|
||||
MapPersistentState::MapPersistentState(uint16 MapId, uint32 InstanceId, Difficulty difficulty)
|
||||
: m_instanceid(InstanceId), m_mapid(MapId),
|
||||
m_difficulty(difficulty), m_usedByMap(NULL)
|
||||
|
|
@ -161,6 +161,7 @@ void MapPersistentState::RemoveGameobjectFromGrid( uint32 guid, GameObjectData c
|
|||
}
|
||||
|
||||
//== WorldPersistentState functions ========================
|
||||
SpawnedPoolData WorldPersistentState::m_sharedSpawnedPoolData;
|
||||
|
||||
bool WorldPersistentState::CanBeUnload() const
|
||||
{
|
||||
|
|
@ -561,6 +562,14 @@ MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const
|
|||
else
|
||||
m_instanceSaveByMapId[mapEntry->MapID] = state;
|
||||
|
||||
// pool system initialized already for persistent state (can be shared by map states)
|
||||
if (!state->GetSpawnedPoolData().IsInitialized())
|
||||
{
|
||||
sPoolMgr.Initialize(state); // init pool system data for map persistent state
|
||||
sGameEventMgr.Initialize(state); // init pool system data for map persistent state
|
||||
state->GetSpawnedPoolData().SetInitialized();
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
@ -819,8 +828,6 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficu
|
|||
else
|
||||
((DungeonMap*)map2)->Reset(INSTANCE_RESET_GLOBAL);
|
||||
}
|
||||
|
||||
// TODO: delete creature/gameobject respawn times even if the maps are not loaded
|
||||
}
|
||||
|
||||
void MapPersistentStateManager::GetStatistics(uint32& numStates, uint32& numBoundPlayers, uint32& numBoundGroups)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue