19 #ifndef TRINITY_MAPMANAGER_H
20 #define TRINITY_MAPMANAGER_H
29 struct TransportCreatureProto;
37 Map* FindBaseNonInstanceMap(
uint32 mapId)
const;
43 Map const* m =
const_cast<MapManager*
>(
this)->CreateBaseMap(mapid);
48 Map const* m =
const_cast<MapManager*
>(
this)->CreateBaseMap(mapid);
53 Map const* m =
const_cast<MapManager*
>(
this)->CreateBaseMap(mapid);
65 i_gridCleanUpDelay = t;
73 i_timer.SetInterval(t);
80 static bool ExistMapAndVMap(
uint32 mapid,
float x,
float y);
81 static bool IsValidMAP(
uint32 mapid,
bool startUp);
103 void DoDelayedMovesAndRemoves();
106 void InitializeVisibilityDistanceInfo();
110 uint32 GetNumPlayersInInstances();
113 void InitInstanceIds();
114 uint32 GenerateInstanceId();
115 void RegisterInstanceId(
uint32 instanceId);
116 void FreeInstanceId(
uint32 instanceId);
123 template<
typename Worker>
124 void DoForAllMaps(Worker&& worker);
126 template<
typename Worker>
127 void DoForAllMapsWithMapId(
uint32 mapId, Worker&& worker);
138 MapMapType::const_iterator iter = i_maps.find(mapId);
139 return (iter == i_maps.end() ?
NULL : iter->second);
155 template<
typename Worker>
158 std::lock_guard<std::mutex> lock(
_mapsLock);
160 for (
auto& mapPair :
i_maps)
162 Map* map = mapPair.second;
166 for (
auto& instancePair : instances)
167 worker(instancePair.second);
174 template<
typename Worker>
177 std::lock_guard<std::mutex> lock(
_mapsLock);
179 auto itr =
i_maps.find(mapId);
182 Map* map = itr->second;
186 for (
auto& p : instances)
194 #define sMapMgr MapManager::instance()
uint32 GetAreaId(float x, float y, float z, bool *isOutdoors) const
Definition: Map.cpp:2426
Definition: MapInstanced.h:28
std::vector< bool > InstanceIds
Definition: MapManager.h:131
Map * FindBaseMap(uint32 mapId) const
Definition: MapManager.h:136
#define MIN_GRID_DELAY
Definition: GridDefines.h:44
Definition: Position.h:228
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid, float x, float y, float z) const
Definition: Map.cpp:2481
static bool IsValidMapCoord(uint32 mapid, float x, float y, float z, float o)
Definition: MapManager.h:93
uint32 _nextInstanceId
Definition: MapManager.h:151
uint32 GetAreaId(uint32 mapid, float x, float y, float z) const
Definition: MapManager.h:41
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Transport.h:28
std::unordered_map< uint32, Map * > MapMapType
Definition: MapManager.h:130
uint32 i_gridCleanUpDelay
Definition: MapManager.h:146
std::unordered_map< uint32, Map * > InstancedMaps
Definition: MapInstanced.h:32
MapMapType i_maps
Definition: MapManager.h:147
void DoForAllMapsWithMapId(uint32 mapId, Worker &&worker)
Definition: MapManager.h:175
static bool IsValidMapCoord(WorldLocation const &loc)
Definition: MapManager.h:98
MapUpdater m_updater
Definition: MapManager.h:152
float GetOrientation() const
Definition: Position.h:107
uint32 GetNextInstanceId() const
Definition: MapManager.h:118
bool IsValidMapCoord(float c)
Definition: GridDefines.h:218
float GetPositionY() const
Definition: Position.h:105
G3D::int16 z
Definition: Vector3int16.h:46
void SetNextInstanceId(uint32 nextInstanceId)
Definition: MapManager.h:119
InstanceIds _instanceIds
Definition: MapManager.h:150
Vector2int16 & operator=(const Any &a)
float GetPositionZ() const
Definition: Position.h:106
uint32_t uint32
Definition: Define.h:150
static void Initialize(PCASC_SALSA20 pState, LPBYTE pbKey, DWORD cbKeyLength, LPBYTE pbVector)
Definition: CascDecrypt.cpp:81
G3D::int16 y
Definition: Vector2int16.h:38
#define MIN_MAP_UPDATE_DELAY
Definition: GridDefines.h:45
uint32 GetMapId() const
Definition: Position.h:254
Definition: MapUpdater.h:31
uint32 GetZoneId(float x, float y, float z) const
Definition: Map.cpp:2471
void DoForAllMaps(Worker &&worker)
Definition: MapManager.h:156
Definition: MapManager.h:31
static bool IsValidMapCoord(uint32 mapid, float x, float y)
Definition: MapManager.h:83
static bool IsValidMapCoord(uint32 mapid, float x, float y, float z)
Definition: MapManager.h:88
#define TC_GAME_API
Definition: Define.h:134
void SetMapUpdateInterval(uint32 t)
Definition: MapManager.h:68
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid, uint32 mapid, float x, float y, float z)
Definition: MapManager.h:51
EnterState
Definition: Map.h:371
void SetGridCleanUpDelay(uint32 t)
Definition: MapManager.h:60
MapUpdater * GetMapUpdater()
Definition: MapManager.h:121
MapInstanced * ToMapInstanced()
Definition: Map.h:492
G3D::int16 x
Definition: Vector2int16.h:37
float GetPositionX() const
Definition: Position.h:104
uint32 GetZoneId(uint32 mapid, float x, float y, float z) const
Definition: MapManager.h:46
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
IntervalTimer i_timer
Definition: MapManager.h:148
std::mutex _mapsLock
Definition: MapManager.h:145