mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 07:37:02 +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 "DBCEnums.h"
|
||||
#include "DBCStores.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "PoolManager.h"
|
||||
|
||||
struct InstanceTemplate;
|
||||
struct MapEntry;
|
||||
|
|
@ -100,6 +101,12 @@ class MapPersistentState
|
|||
}
|
||||
void SaveGORespawnTime(uint32 loguid, time_t t);
|
||||
|
||||
// pool system
|
||||
virtual SpawnedPoolData& GetSpawnedPoolData() =0;
|
||||
|
||||
template<typename T>
|
||||
bool IsSpawnedPoolObject(uint32 db_guid_or_pool_id) { return GetSpawnedPoolData().IsSpawnedObject<T>(db_guid_or_pool_id); }
|
||||
|
||||
// grid objects (Dynamic map/instance specific added/removed grid spawns from pool system/etc)
|
||||
MapCellObjectGuids const& GetCellObjectGuids(uint32 cell_id) { return m_gridObjectGuids[cell_id]; }
|
||||
void AddCreatureToGrid(uint32 guid, CreatureData const* data);
|
||||
|
|
@ -148,8 +155,12 @@ class WorldPersistentState : public MapPersistentState
|
|||
|
||||
~WorldPersistentState() {}
|
||||
|
||||
SpawnedPoolData& GetSpawnedPoolData() { return m_sharedSpawnedPoolData; }
|
||||
protected:
|
||||
bool CanBeUnload() const; // overwrite MapPersistentState::CanBeUnload
|
||||
|
||||
private:
|
||||
static SpawnedPoolData m_sharedSpawnedPoolData; // Pools spawns state for map, shared by all non-instanced maps
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -172,6 +183,8 @@ class DungeonPersistentState : public MapPersistentState
|
|||
|
||||
~DungeonPersistentState();
|
||||
|
||||
SpawnedPoolData& GetSpawnedPoolData() { return m_spawnedPoolData; }
|
||||
|
||||
InstanceTemplate const* GetTemplate() const;
|
||||
|
||||
uint8 GetPlayerCount() const { return m_playerList.size(); }
|
||||
|
|
@ -220,6 +233,8 @@ class DungeonPersistentState : public MapPersistentState
|
|||
TODO: maybe it's enough to just store the number of players/groups */
|
||||
PlayerListType m_playerList; // lock MapPersistentState from unload
|
||||
GroupListType m_groupList; // lock MapPersistentState from unload
|
||||
|
||||
SpawnedPoolData m_spawnedPoolData; // Pools spawns state for map copy
|
||||
};
|
||||
|
||||
class BattleGroundPersistentState : public MapPersistentState
|
||||
|
|
@ -233,8 +248,12 @@ class BattleGroundPersistentState : public MapPersistentState
|
|||
|
||||
~BattleGroundPersistentState() {}
|
||||
|
||||
SpawnedPoolData& GetSpawnedPoolData() { return m_spawnedPoolData; }
|
||||
protected:
|
||||
bool CanBeUnload() const; // overwrite MapPersistentState::CanBeUnload
|
||||
|
||||
private:
|
||||
SpawnedPoolData m_spawnedPoolData; // Pools spawns state for map copy
|
||||
};
|
||||
|
||||
enum ResetEventType
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue