Core/Instances: Recycle instance IDs. Should fix instance ID shifting and related issues with instance binding.
fixes #736
This commit is contained in:
@@ -34,6 +34,7 @@ class MapManager
|
||||
{
|
||||
friend class ACE_Singleton<MapManager, ACE_Thread_Mutex>;
|
||||
typedef UNORDERED_MAP<uint32, Map*> MapMapType;
|
||||
typedef std::vector<bool> InstanceIds;
|
||||
|
||||
public:
|
||||
|
||||
@@ -132,14 +133,21 @@ class MapManager
|
||||
TransportMap m_TransportsByMap;
|
||||
|
||||
bool CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck = false);
|
||||
uint32 GenerateInstanceId() { return ++i_MaxInstanceId; }
|
||||
void InitMaxInstanceId();
|
||||
void InitializeVisibilityDistanceInfo();
|
||||
|
||||
/* statistics */
|
||||
uint32 GetNumInstances();
|
||||
uint32 GetNumPlayersInInstances();
|
||||
|
||||
// Instance ID management
|
||||
void InitInstanceIds();
|
||||
uint32 GenerateInstanceId();
|
||||
void RegisterInstanceId(uint32 instanceId);
|
||||
void FreeInstanceId(uint32 instanceId);
|
||||
|
||||
uint32 GetNextInstanceId() { return _nextInstanceId; };
|
||||
void SetNextInstanceId(uint32 nextInstanceId) { _nextInstanceId = nextInstanceId; };
|
||||
|
||||
private:
|
||||
// debugging code, should be deleted some day
|
||||
void checkAndCorrectGridStatesArray(); // just for debugging to find some memory overwrites
|
||||
@@ -164,7 +172,8 @@ class MapManager
|
||||
MapMapType i_maps;
|
||||
IntervalTimer i_timer;
|
||||
|
||||
uint32 i_MaxInstanceId;
|
||||
InstanceIds _instanceIds;
|
||||
uint32 _nextInstanceId;
|
||||
MapUpdater m_updater;
|
||||
};
|
||||
#define sMapMgr ACE_Singleton<MapManager, ACE_Thread_Mutex>::instance()
|
||||
|
||||
Reference in New Issue
Block a user