aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/MapManager.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-02-11 21:59:21 +0100
committerShauren <shauren.trinity@gmail.com>2022-02-11 21:59:21 +0100
commit665bab608c739764a2fe0b4e5ae1f7c37c5814a1 (patch)
treeddd852e86352e69628263a80b6ae63483ce49592 /src/server/game/Maps/MapManager.cpp
parent8fd05dbc931aa557177f666729b5654b2908b46e (diff)
Core/Misc: Cleanup MapManager includes (boost::dynamic_bitset)
Diffstat (limited to 'src/server/game/Maps/MapManager.cpp')
-rw-r--r--src/server/game/Maps/MapManager.cpp44
1 files changed, 21 insertions, 23 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);
}