aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Maps/MapManager.cpp44
-rw-r--r--src/server/game/Maps/MapManager.h6
2 files changed, 23 insertions, 27 deletions
diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp
index 58ed8b496af..75bd2f81f1b 100644
--- a/src/server/game/Maps/MapManager.cpp
+++ b/src/server/game/Maps/MapManager.cpp
@@ -16,25 +16,23 @@
*/
#include "MapManager.h"
-#include "InstanceSaveMgr.h"
+#include "Config.h"
+#include "Corpse.h"
#include "DatabaseEnv.h"
#include "DB2Stores.h"
-#include "Log.h"
-#include "ObjectAccessor.h"
-#include "Transport.h"
#include "GridDefines.h"
-#include "MapInstanced.h"
+#include "Group.h"
+#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
-#include "Config.h"
-#include "World.h"
-#include "Corpse.h"
+#include "Log.h"
+#include "MapInstanced.h"
+#include "MiscPackets.h"
#include "ObjectMgr.h"
-#include "WorldPacket.h"
-#include "Group.h"
#include "Player.h"
-#include "WorldSession.h"
-#include "Opcodes.h"
-#include "MiscPackets.h"
+#include "Transport.h"
+#include "World.h"
+#include "WorldPacket.h"
+#include <boost/dynamic_bitset.hpp>
MapManager::MapManager()
: _nextInstanceId(0), _scheduledScripts(0)
@@ -339,18 +337,18 @@ void MapManager::InitInstanceIds()
_nextInstanceId = 1;
if (QueryResult result = CharacterDatabase.Query("SELECT IFNULL(MAX(id), 0) FROM instance"))
- _freeInstanceIds.resize((*result)[0].GetUInt64() + 2, true); // make space for one extra to be able to access [_nextInstanceId] index in case all slots are taken
+ _freeInstanceIds->resize((*result)[0].GetUInt64() + 2, true); // make space for one extra to be able to access [_nextInstanceId] index in case all slots are taken
else
- _freeInstanceIds.resize(_nextInstanceId + 1, true);
+ _freeInstanceIds->resize(_nextInstanceId + 1, true);
// never allow 0 id
- _freeInstanceIds[0] = false;
+ _freeInstanceIds->set(0, false);
}
void MapManager::RegisterInstanceId(uint32 instanceId)
{
// Allocation and sizing was done in InitInstanceIds()
- _freeInstanceIds[instanceId] = false;
+ _freeInstanceIds->set(instanceId, false);
// Instances are pulled in ascending order from db and nextInstanceId is initialized with 1,
// so if the instance id is used, increment until we find the first unused one for a potential new instance
@@ -368,15 +366,15 @@ uint32 MapManager::GenerateInstanceId()
}
uint32 newInstanceId = _nextInstanceId;
- ASSERT(newInstanceId < _freeInstanceIds.size());
- _freeInstanceIds[newInstanceId] = false;
+ ASSERT(newInstanceId < _freeInstanceIds->size());
+ _freeInstanceIds->set(newInstanceId, false);
// Find the lowest available id starting from the current NextInstanceId (which should be the lowest according to the logic in FreeInstanceId())
- size_t nextFreedId = _freeInstanceIds.find_next(_nextInstanceId++);
+ size_t nextFreedId = _freeInstanceIds->find_next(_nextInstanceId++);
if (nextFreedId == InstanceIds::npos)
{
- _nextInstanceId = uint32(_freeInstanceIds.size());
- _freeInstanceIds.push_back(true);
+ _nextInstanceId = uint32(_freeInstanceIds->size());
+ _freeInstanceIds->push_back(true);
}
else
_nextInstanceId = uint32(nextFreedId);
@@ -388,5 +386,5 @@ void MapManager::FreeInstanceId(uint32 instanceId)
{
// If freed instance id is lower than the next id available for new instances, use the freed one instead
_nextInstanceId = std::min(instanceId, _nextInstanceId);
- _freeInstanceIds[instanceId] = true;
+ _freeInstanceIds->set(instanceId, true);
}
diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h
index 04774ae0865..432795b11fb 100644
--- a/src/server/game/Maps/MapManager.h
+++ b/src/server/game/Maps/MapManager.h
@@ -18,16 +18,14 @@
#ifndef TRINITY_MAPMANAGER_H
#define TRINITY_MAPMANAGER_H
-#include "Object.h"
#include "Map.h"
#include "MapInstanced.h"
#include "GridStates.h"
#include "MapUpdater.h"
-#include <boost/dynamic_bitset.hpp>
+#include <boost/dynamic_bitset_fwd.hpp>
class PhaseShift;
class Transport;
-struct TransportCreatureProto;
class TC_GAME_API MapManager
{
@@ -164,7 +162,7 @@ class TC_GAME_API MapManager
MapMapType i_maps;
IntervalTimer i_timer;
- InstanceIds _freeInstanceIds;
+ std::unique_ptr<InstanceIds> _freeInstanceIds;
uint32 _nextInstanceId;
MapUpdater m_updater;