TrinityCore
MapManager Class Reference

#include <MapManager.h>

Public Member Functions

 MapManager (MapManager const &)=delete
 
 MapManager (MapManager &&)=delete
 
MapManageroperator= (MapManager const &)=delete
 
MapManageroperator= (MapManager &&)=delete
 
MapCreateMap (uint32 mapId, Player *player)
 
MapFindMap (uint32 mapId, uint32 instanceId) const
 
uint32 FindInstanceIdForPlayer (uint32 mapId, Player const *player) const
 
void Initialize ()
 
void Update (uint32 diff)
 
void SetGridCleanUpDelay (uint32 t)
 
void SetMapUpdateInterval (uint32 t)
 
void UnloadAll ()
 
void InitializeVisibilityDistanceInfo ()
 
uint32 GetNumInstances () const
 
uint32 GetNumPlayersInInstances () const
 
void InitInstanceIds ()
 
uint32 GenerateInstanceId ()
 
void RegisterInstanceId (uint32 instanceId)
 
void FreeInstanceId (uint32 instanceId)
 
MapUpdaterGetMapUpdater ()
 
template<typename Worker >
void DoForAllMaps (Worker &&worker)
 
template<typename Worker >
void DoForAllMapsWithMapId (uint32 mapId, Worker &&worker)
 
void IncreaseScheduledScriptsCount ()
 
void DecreaseScheduledScriptCount ()
 
void DecreaseScheduledScriptCount (std::size_t count)
 
bool IsScriptScheduled () const
 
void AddSC_BuiltInScripts ()
 

Static Public Member Functions

static MapManagerinstance ()
 
static bool IsValidMAP (uint32 mapId)
 
static bool IsValidMapCoord (uint32 mapid, float x, float y)
 
static bool IsValidMapCoord (uint32 mapid, float x, float y, float z)
 
static bool IsValidMapCoord (uint32 mapid, float x, float y, float z, float o)
 
static bool IsValidMapCoord (uint32 mapid, Position const &pos)
 
static bool IsValidMapCoord (WorldLocation const &loc)
 

Private Types

using MapKey = std::pair< uint32, uint32 >
 
typedef std::map< MapKey, Trinity::unique_trackable_ptr< Map > > MapMapType
 
typedef boost::dynamic_bitset< size_t > InstanceIds
 

Private Member Functions

 MapManager ()
 
 ~MapManager ()
 
MapFindMap_i (uint32 mapId, uint32 instanceId) const
 
MapCreateWorldMap (uint32 mapId, uint32 instanceId)
 
InstanceMapCreateInstance (uint32 mapId, uint32 instanceId, InstanceLock *instanceLock, Difficulty difficulty, TeamId team, Group *group)
 
BattlegroundMapCreateBattleground (uint32 mapId, uint32 instanceId, Battleground *bg)
 
GarrisonMapCreateGarrison (uint32 mapId, uint32 instanceId, Player *owner)
 
bool DestroyMap (Map *map)
 

Private Attributes

std::shared_mutex _mapsLock
 
uint32 i_gridCleanUpDelay
 
MapMapType i_maps
 
IntervalTimer i_timer
 
std::unique_ptr< InstanceIds_freeInstanceIds
 
uint32 _nextInstanceId
 
MapUpdater m_updater
 
std::atomic< std::size_t > _scheduledScripts
 

Detailed Description

Definition at line 41 of file MapManager.h.

Member Typedef Documentation

◆ InstanceIds

typedef boost::dynamic_bitset<size_t> MapManager::InstanceIds
private

Definition at line 137 of file MapManager.h.

◆ MapKey

using MapManager::MapKey = std::pair<uint32, uint32>
private

Definition at line 135 of file MapManager.h.

◆ MapMapType

Definition at line 136 of file MapManager.h.

Constructor & Destructor Documentation

◆ MapManager() [1/3]

MapManager::MapManager ( )
private

Definition at line 38 of file MapManager.cpp.

+ Here is the call graph for this function:

◆ ~MapManager()

MapManager::~MapManager ( )
privatedefault

◆ MapManager() [2/3]

MapManager::MapManager ( MapManager const &  )
delete

◆ MapManager() [3/3]

MapManager::MapManager ( MapManager &&  )
delete

Member Function Documentation

◆ AddSC_BuiltInScripts()

void MapManager::AddSC_BuiltInScripts ( )

Definition at line 486 of file MapManager.cpp.

+ Here is the call graph for this function:

◆ CreateBattleground()

BattlegroundMap * MapManager::CreateBattleground ( uint32  mapId,
uint32  instanceId,
Battleground bg 
)
private

Definition at line 122 of file MapManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateGarrison()

GarrisonMap * MapManager::CreateGarrison ( uint32  mapId,
uint32  instanceId,
Player owner 
)
private

Definition at line 138 of file MapManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateInstance()

InstanceMap * MapManager::CreateInstance ( uint32  mapId,
uint32  instanceId,
InstanceLock instanceLock,
Difficulty  difficulty,
TeamId  team,
Group group 
)
private

Definition at line 88 of file MapManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateMap()

Map * MapManager::CreateMap ( uint32  mapId,
Player player 
)

Definition at line 151 of file MapManager.cpp.

+ Here is the call graph for this function:

◆ CreateWorldMap()

Map * MapManager::CreateWorldMap ( uint32  mapId,
uint32  instanceId 
)
private

Definition at line 75 of file MapManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DecreaseScheduledScriptCount() [1/2]

void MapManager::DecreaseScheduledScriptCount ( )
inline

Definition at line 128 of file MapManager.h.

◆ DecreaseScheduledScriptCount() [2/2]

void MapManager::DecreaseScheduledScriptCount ( std::size_t  count)
inline

Definition at line 129 of file MapManager.h.

◆ DestroyMap()

bool MapManager::DestroyMap ( Map map)
private

Definition at line 352 of file MapManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoForAllMaps()

template<typename Worker >
void MapManager::DoForAllMaps ( Worker &&  worker)

Definition at line 162 of file MapManager.h.

◆ DoForAllMapsWithMapId()

template<typename Worker >
void MapManager::DoForAllMapsWithMapId ( uint32  mapId,
Worker &&  worker 
)

Definition at line 171 of file MapManager.h.

+ Here is the call graph for this function:

◆ FindInstanceIdForPlayer()

uint32 MapManager::FindInstanceIdForPlayer ( uint32  mapId,
Player const *  player 
) const

Definition at line 274 of file MapManager.cpp.

+ Here is the call graph for this function:

◆ FindMap()

Map * MapManager::FindMap ( uint32  mapId,
uint32  instanceId 
) const

Definition at line 268 of file MapManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindMap_i()

Map * MapManager::FindMap_i ( uint32  mapId,
uint32  instanceId 
) const
private

Definition at line 69 of file MapManager.cpp.

+ Here is the caller graph for this function:

◆ FreeInstanceId()

void MapManager::FreeInstanceId ( uint32  instanceId)

Definition at line 464 of file MapManager.cpp.

◆ GenerateInstanceId()

uint32 MapManager::GenerateInstanceId ( )

Definition at line 438 of file MapManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMapUpdater()

MapUpdater * MapManager::GetMapUpdater ( )
inline

Definition at line 119 of file MapManager.h.

◆ GetNumInstances()

uint32 MapManager::GetNumInstances ( ) const

Definition at line 398 of file MapManager.cpp.

◆ GetNumPlayersInInstances()

uint32 MapManager::GetNumPlayersInInstances ( ) const

Definition at line 404 of file MapManager.cpp.

◆ IncreaseScheduledScriptsCount()

void MapManager::IncreaseScheduledScriptsCount ( )
inline

Definition at line 127 of file MapManager.h.

◆ Initialize()

void MapManager::Initialize ( )

Definition at line 47 of file MapManager.cpp.

+ Here is the call graph for this function:

◆ InitializeVisibilityDistanceInfo()

void MapManager::InitializeVisibilityDistanceInfo ( )

Definition at line 57 of file MapManager.cpp.

◆ InitInstanceIds()

void MapManager::InitInstanceIds ( )

Definition at line 410 of file MapManager.cpp.

◆ instance()

MapManager * MapManager::instance ( )
static

Definition at line 63 of file MapManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsScriptScheduled()

bool MapManager::IsScriptScheduled ( ) const
inline

Definition at line 130 of file MapManager.h.

◆ IsValidMAP()

bool MapManager::IsValidMAP ( uint32  mapId)
static

Definition at line 372 of file MapManager.cpp.

+ Here is the caller graph for this function:

◆ IsValidMapCoord() [1/5]

static bool MapManager::IsValidMapCoord ( uint32  mapid,
float  x,
float  y 
)
inlinestatic

Definition at line 82 of file MapManager.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsValidMapCoord() [2/5]

static bool MapManager::IsValidMapCoord ( uint32  mapid,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 87 of file MapManager.h.

+ Here is the call graph for this function:

◆ IsValidMapCoord() [3/5]

static bool MapManager::IsValidMapCoord ( uint32  mapid,
float  x,
float  y,
float  z,
float  o 
)
inlinestatic

Definition at line 92 of file MapManager.h.

+ Here is the call graph for this function:

◆ IsValidMapCoord() [4/5]

static bool MapManager::IsValidMapCoord ( uint32  mapid,
Position const &  pos 
)
inlinestatic

Definition at line 97 of file MapManager.h.

+ Here is the call graph for this function:

◆ IsValidMapCoord() [5/5]

static bool MapManager::IsValidMapCoord ( WorldLocation const &  loc)
inlinestatic

Definition at line 102 of file MapManager.h.

+ Here is the call graph for this function:

◆ operator=() [1/2]

MapManager & MapManager::operator= ( MapManager &&  )
delete

◆ operator=() [2/2]

MapManager & MapManager::operator= ( MapManager const &  )
delete

◆ RegisterInstanceId()

void MapManager::RegisterInstanceId ( uint32  instanceId)

Definition at line 427 of file MapManager.cpp.

◆ SetGridCleanUpDelay()

void MapManager::SetGridCleanUpDelay ( uint32  t)
inline

Definition at line 61 of file MapManager.h.

◆ SetMapUpdateInterval()

void MapManager::SetMapUpdateInterval ( uint32  t)
inline

Definition at line 69 of file MapManager.h.

◆ UnloadAll()

void MapManager::UnloadAll ( )

Definition at line 377 of file MapManager.cpp.

+ Here is the call graph for this function:

◆ Update()

void MapManager::Update ( uint32  diff)

Definition at line 317 of file MapManager.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ _freeInstanceIds

std::unique_ptr<InstanceIds> MapManager::_freeInstanceIds
private

Definition at line 153 of file MapManager.h.

◆ _mapsLock

std::shared_mutex MapManager::_mapsLock
mutableprivate

Definition at line 148 of file MapManager.h.

◆ _nextInstanceId

uint32 MapManager::_nextInstanceId
private

Definition at line 154 of file MapManager.h.

◆ _scheduledScripts

std::atomic<std::size_t> MapManager::_scheduledScripts
private

Definition at line 158 of file MapManager.h.

◆ i_gridCleanUpDelay

uint32 MapManager::i_gridCleanUpDelay
private

Definition at line 149 of file MapManager.h.

◆ i_maps

MapMapType MapManager::i_maps
private

Definition at line 150 of file MapManager.h.

◆ i_timer

IntervalTimer MapManager::i_timer
private

Definition at line 151 of file MapManager.h.

◆ m_updater

MapUpdater MapManager::m_updater
private

Definition at line 155 of file MapManager.h.


The documentation for this class was generated from the following files: