TrinityCore
Loading...
Searching...
No Matches
Map Class Reference

#include <Map.h>

Public Types

typedef MapRefManager PlayerList
 
typedef std::unordered_multimap< ObjectGuid::LowType, Creature * > CreatureBySpawnIdContainer
 
typedef std::unordered_multimap< ObjectGuid::LowType, GameObject * > GameObjectBySpawnIdContainer
 
typedef std::unordered_multimap< ObjectGuid::LowType, AreaTrigger * > AreaTriggerBySpawnIdContainer
 
typedef std::function< void(Map *)> FarSpellCallback
 
- Public Types inherited from GridRefManager< NGridType >
typedef LinkedListHead::Iterator< GridReference< NGridType > > iterator
 
- Public Types inherited from RefManager< TO, FROM >
typedef LinkedListHead::Iterator< Reference< TO, FROM > > iterator
 
typedef LinkedListHead::Iterator< Reference< TO, FROM > const > const_iterator
 
- Public Types inherited from LinkedListHead
typedef Iterator< LinkedListElementiterator
 

Public Member Functions

 Map (uint32 id, time_t, uint32 InstanceId, Difficulty SpawnMode)
 
virtual ~Map ()
 
MapEntry const * GetEntry () const
 
bool CanUnload (uint32 diff)
 
virtual bool AddPlayerToMap (Player *player, bool initPlayer=true)
 
virtual void RemovePlayerFromMap (Player *, bool)
 
template<class T >
bool AddToMap (T *)
 
template<class T >
void RemoveFromMap (T *, bool)
 
void VisitNearbyCellsOf (WorldObject *obj, TypeContainerVisitor< Trinity::ObjectUpdater, GridTypeMapContainer > &gridVisitor, TypeContainerVisitor< Trinity::ObjectUpdater, WorldTypeMapContainer > &worldVisitor)
 
virtual void Update (uint32)
 
float GetVisibilityRange () const
 
virtual void InitVisibilityDistance ()
 
void PlayerRelocation (Player *, float x, float y, float z, float orientation)
 
void CreatureRelocation (Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
 
void GameObjectRelocation (GameObject *go, float x, float y, float z, float orientation, bool respawnRelocationOnFail=true)
 
void DynamicObjectRelocation (DynamicObject *go, float x, float y, float z, float orientation)
 
void AreaTriggerRelocation (AreaTrigger *at, float x, float y, float z, float orientation)
 
template<class T , class CONTAINER >
void Visit (Cell const &cell, TypeContainerVisitor< T, CONTAINER > &visitor)
 
bool IsRemovalGrid (float x, float y) const
 
bool IsRemovalGrid (Position const &pos) const
 
bool IsGridLoaded (uint32 gridId) const
 
bool IsGridLoaded (float x, float y) const
 
bool IsGridLoaded (Position const &pos) const
 
bool GetUnloadLock (GridCoord const &p) const
 
void SetUnloadLock (GridCoord const &p, bool on)
 
void LoadGrid (float x, float y)
 
void LoadGridForActiveObject (float x, float y, WorldObject const *object)
 
void LoadAllCells ()
 
bool UnloadGrid (NGridType &ngrid, bool pForce)
 
void GridMarkNoUnload (uint32 x, uint32 y)
 
void GridUnmarkNoUnload (uint32 x, uint32 y)
 
void UnloadAll ()
 
void ResetGridExpiry (NGridType &grid, float factor=1) const
 
time_t GetGridExpiry () const
 
TerrainInfoGetTerrain () const
 
void GetFullTerrainStatusForPosition (PhaseShift const &phaseShift, float x, float y, float z, PositionFullTerrainStatus &data, map_liquidHeaderTypeFlags reqLiquidType=map_liquidHeaderTypeFlags::AllLiquids, float collisionHeight=2.03128f)
 
ZLiquidStatus GetLiquidStatus (PhaseShift const &phaseShift, float x, float y, float z, map_liquidHeaderTypeFlags ReqLiquidType, LiquidData *data=nullptr, float collisionHeight=2.03128f)
 
bool GetAreaInfo (PhaseShift const &phaseShift, float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId)
 
uint32 GetAreaId (PhaseShift const &phaseShift, float x, float y, float z)
 
uint32 GetAreaId (PhaseShift const &phaseShift, Position const &pos)
 
uint32 GetZoneId (PhaseShift const &phaseShift, float x, float y, float z)
 
uint32 GetZoneId (PhaseShift const &phaseShift, Position const &pos)
 
void GetZoneAndAreaId (PhaseShift const &phaseShift, uint32 &zoneid, uint32 &areaid, float x, float y, float z)
 
void GetZoneAndAreaId (PhaseShift const &phaseShift, uint32 &zoneid, uint32 &areaid, Position const &pos)
 
float GetMinHeight (PhaseShift const &phaseShift, float x, float y)
 
float GetGridHeight (PhaseShift const &phaseShift, float x, float y)
 
float GetStaticHeight (PhaseShift const &phaseShift, float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
 
float GetStaticHeight (PhaseShift const &phaseShift, Position const &pos, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
 
float GetHeight (PhaseShift const &phaseShift, float x, float y, float z, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
 
float GetHeight (PhaseShift const &phaseShift, Position const &pos, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
 
float GetWaterLevel (PhaseShift const &phaseShift, float x, float y)
 
bool IsInWater (PhaseShift const &phaseShift, float x, float y, float z, LiquidData *data=nullptr)
 
bool IsUnderWater (PhaseShift const &phaseShift, float x, float y, float z)
 
float GetWaterOrGroundLevel (PhaseShift const &phaseShift, float x, float y, float z, float *ground=nullptr, bool swim=false, float collisionHeight=2.03128f)
 
void MoveAllCreaturesInMoveList ()
 
void MoveAllGameObjectsInMoveList ()
 
void MoveAllDynamicObjectsInMoveList ()
 
void MoveAllAreaTriggersInMoveList ()
 
void RemoveAllObjectsInRemoveList ()
 
virtual void RemoveAllPlayers ()
 
bool CreatureRespawnRelocation (Creature *c, bool diffGridOnly)
 
bool GameObjectRespawnRelocation (GameObject *go, bool diffGridOnly)
 
uint32 GetInstanceId () const
 
virtual TransferAbortParams CannotEnter (Player *)
 
char const * GetMapName () const
 
Difficulty GetDifficultyID () const
 
MapDifficultyEntry const * GetMapDifficulty () const
 
uint32 GetId () const
 
bool Instanceable () const
 
bool IsDungeon () const
 
bool IsNonRaidDungeon () const
 
bool IsRaid () const
 
bool IsHeroic () const
 
bool Is25ManRaid () const
 
bool IsBattleground () const
 
bool IsBattleArena () const
 
bool IsBattlegroundOrArena () const
 
bool IsScenario () const
 
bool IsGarrison () const
 
bool GetEntrancePos (int32 &mapid, float &x, float &y)
 
void AddObjectToRemoveList (WorldObject *obj)
 
void AddObjectToSwitchList (WorldObject *obj, bool on)
 
virtual void DelayedUpdate (uint32 diff)
 
void resetMarkedCells ()
 
bool isCellMarked (uint32 pCellId)
 
void markCell (uint32 pCellId)
 
bool HavePlayers () const
 
uint32 GetPlayersCountExceptGMs () const
 
bool ActiveObjectsNearGrid (NGridType const &ngrid) const
 
void AddWorldObject (WorldObject *obj)
 
void RemoveWorldObject (WorldObject *obj)
 
void SendToPlayers (WorldPacket const *data) const
 
PlayerList const & GetPlayers () const
 
template<typename T >
void DoOnPlayers (T &&fn)
 
void ScriptsStart (std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
 Put scripts in the execution queue.
 
void ScriptCommandStart (ScriptInfo const &script, uint32 delay, Object *source, Object *target)
 
void AddToActive (WorldObject *obj)
 
void RemoveFromActive (WorldObject *obj)
 
template<class T >
void SwitchGridContainers (T *obj, bool on)
 
void UpdateIteratorBack (Player *player)
 
TempSummonSummonCreature (uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, Milliseconds duration=0ms, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty, SmoothPhasingInfo const *smoothPhasingInfo=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
AreaTriggerGetAreaTrigger (ObjectGuid const &guid)
 
SceneObjectGetSceneObject (ObjectGuid const &guid)
 
ConversationGetConversation (ObjectGuid const &guid)
 
PlayerGetPlayer (ObjectGuid const &guid)
 
CorpseGetCorpse (ObjectGuid const &guid)
 
CreatureGetCreature (ObjectGuid const &guid)
 
DynamicObjectGetDynamicObject (ObjectGuid const &guid)
 
GameObjectGetGameObject (ObjectGuid const &guid)
 
PetGetPet (ObjectGuid const &guid)
 
TransportGetTransport (ObjectGuid const &guid)
 
CreatureGetCreatureBySpawnId (ObjectGuid::LowType spawnId) const
 
GameObjectGetGameObjectBySpawnId (ObjectGuid::LowType spawnId) const
 
AreaTriggerGetAreaTriggerBySpawnId (ObjectGuid::LowType spawnId) const
 
WorldObjectGetWorldObjectBySpawnId (SpawnObjectType type, ObjectGuid::LowType spawnId) const
 
MapStoredObjectTypesContainerGetObjectsStore ()
 
CreatureBySpawnIdContainerGetCreatureBySpawnIdStore ()
 
CreatureBySpawnIdContainer const & GetCreatureBySpawnIdStore () const
 
GameObjectBySpawnIdContainerGetGameObjectBySpawnIdStore ()
 
GameObjectBySpawnIdContainer const & GetGameObjectBySpawnIdStore () const
 
AreaTriggerBySpawnIdContainerGetAreaTriggerBySpawnIdStore ()
 
AreaTriggerBySpawnIdContainer const & GetAreaTriggerBySpawnIdStore () const
 
std::unordered_set< Corpse * > const * GetCorpsesInCell (uint32 cellId) const
 
CorpseGetCorpseByPlayer (ObjectGuid const &ownerGuid) const
 
InstanceMapToInstanceMap ()
 
InstanceMap const * ToInstanceMap () const
 
BattlegroundMapToBattlegroundMap ()
 
BattlegroundMap const * ToBattlegroundMap () const
 
bool isInLineOfSight (PhaseShift const &phaseShift, float x1, float y1, float z1, float x2, float y2, float z2, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
 
void Balance ()
 
void RemoveGameObjectModel (GameObjectModel const &model)
 
void InsertGameObjectModel (GameObjectModel const &model)
 
bool ContainsGameObjectModel (GameObjectModel const &model) const
 
float GetGameObjectFloor (PhaseShift const &phaseShift, float x, float y, float z, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
 
bool getObjectHitPos (PhaseShift const &phaseShift, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist)
 
virtual ObjectGuid::LowType GetOwnerGuildId (uint32=TEAM_OTHER) const
 
time_t GetLinkedRespawnTime (ObjectGuid guid) const
 
time_t GetRespawnTime (SpawnObjectType type, ObjectGuid::LowType spawnId) const
 
time_t GetCreatureRespawnTime (ObjectGuid::LowType spawnId) const
 
time_t GetGORespawnTime (ObjectGuid::LowType spawnId) const
 
void UpdatePlayerZoneStats (uint32 oldZone, uint32 newZone)
 
void SaveRespawnTime (SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 entry, time_t respawnTime, uint32 gridId, CharacterDatabaseTransaction dbTrans=nullptr, bool startup=false)
 
void SaveRespawnInfoDB (RespawnInfo const &info, CharacterDatabaseTransaction dbTrans=nullptr)
 
void LoadRespawnTimes ()
 
void DeleteRespawnTimes ()
 
void DeleteRespawnTimesInDB ()
 
void LoadCorpseData ()
 
void DeleteCorpseData ()
 
void AddCorpse (Corpse *corpse)
 
void RemoveCorpse (Corpse *corpse)
 
CorpseConvertCorpseToBones (ObjectGuid const &ownerGuid, bool insignia=false)
 
void RemoveOldCorpses ()
 
void SendInitTransports (Player *player)
 
void SendRemoveTransports (Player *player)
 
void SendUpdateTransportVisibility (Player *player)
 
void SendZoneDynamicInfo (uint32 zoneId, Player *player) const
 
void SendZoneWeather (uint32 zoneId, Player *player) const
 
void SendZoneWeather (ZoneDynamicInfo const &zoneDynamicInfo, Player *player) const
 
void SetZoneMusic (uint32 zoneId, uint32 musicId)
 
WeatherGetOrGenerateZoneDefaultWeather (uint32 zoneId)
 
WeatherState GetZoneWeather (uint32 zoneId) const
 
void SetZoneWeather (uint32 zoneId, WeatherState weatherId, float intensity)
 
void SetZoneOverrideLight (uint32 zoneId, uint32 areaLightId, uint32 overrideLightId, Milliseconds transitionTime)
 
void UpdateAreaDependentAuras ()
 
template<HighGuid high>
ObjectGuid::LowType GenerateLowGuid ()
 
template<HighGuid high>
ObjectGuid::LowType GetMaxLowGuid ()
 
void AddUpdateObject (Object *obj)
 
void RemoveUpdateObject (Object *obj)
 
size_t GetActiveNonPlayersCount () const
 
virtual std::string GetDebugInfo () const
 
void ProcessRespawns ()
 
void ApplyDynamicModeRespawnScaling (WorldObject const *obj, ObjectGuid::LowType spawnId, uint32 &respawnDelay, uint32 mode) const
 
void GetRespawnInfo (std::vector< RespawnInfo const * > &respawnData, SpawnObjectTypeMask types) const
 
void Respawn (SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr)
 
void RemoveRespawnTime (SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr, bool alwaysDeleteFromDB=false)
 
size_t DespawnAll (SpawnObjectType type, ObjectGuid::LowType spawnId)
 
bool ShouldBeSpawnedOnGridLoad (SpawnObjectType type, ObjectGuid::LowType spawnId) const
 
template<typename T >
bool ShouldBeSpawnedOnGridLoad (ObjectGuid::LowType spawnId) const
 
SpawnGroupTemplateData const * GetSpawnGroupData (uint32 groupId) const
 
bool IsSpawnGroupActive (uint32 groupId) const
 
bool SpawnGroupSpawn (uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
 
bool SpawnGroupDespawn (uint32 groupId, bool deleteRespawnTimes=false, size_t *count=nullptr)
 
void SetSpawnGroupInactive (uint32 groupId)
 
SpawnedPoolDataGetPoolData ()
 
SpawnedPoolData const & GetPoolData () const
 
void AddFarSpellCallback (FarSpellCallback &&callback)
 
void UpdateSpawnGroupConditions ()
 
MultiPersonalPhaseTrackerGetMultiPersonalPhaseTracker ()
 
void UpdatePersonalPhasesForPlayer (Player const *player)
 
int32 GetWorldStateValue (int32 worldStateId) const
 
void SetWorldStateValue (int32 worldStateId, int32 value, bool hidden)
 
WorldStateValueContainer const & GetWorldStateValues () const
 
template<>
void AddToGrid (Creature *obj, Cell const &cell)
 
template<>
void AddToGrid (GameObject *obj, Cell const &cell)
 
template<>
void AddToGrid (DynamicObject *obj, Cell const &cell)
 
template<>
void AddToGrid (AreaTrigger *obj, Cell const &cell)
 
template<>
void AddToGrid (Corpse *obj, Cell const &cell)
 
template<>
void SwitchGridContainers (Creature *obj, bool on)
 
template<>
void DeleteFromWorld (Player *player)
 
template<>
void InitializeObject (Creature *obj)
 
template<>
void InitializeObject (GameObject *obj)
 
template<>
bool AddToMap (Transport *obj)
 
template<>
void RemoveFromMap (Transport *obj, bool remove)
 
- Public Member Functions inherited from GridRefManager< NGridType >
GridReference< NGridType > * getFirst ()
 
GridReference< NGridType > * getLast ()
 
iterator begin ()
 
iterator end ()
 
- Public Member Functions inherited from RefManager< TO, FROM >
 RefManager ()
 
Reference< TO, FROM > * getFirst ()
 
Reference< TO, FROM > const * getFirst () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
virtual ~RefManager ()
 
void clearReferences ()
 
- Public Member Functions inherited from LinkedListHead
 LinkedListHead ()
 
bool isEmpty () const
 
LinkedListElementgetFirst ()
 
LinkedListElement const * getFirst () const
 
LinkedListElementgetLast ()
 
LinkedListElement const * getLast () const
 
void insertFirst (LinkedListElement *pElem)
 
void insertLast (LinkedListElement *pElem)
 
uint32 getSize () const
 
void incSize ()
 
void decSize ()
 

Static Public Member Functions

static void InitStateMachine ()
 
static void DeleteStateMachine ()
 
template<typename T >
static bool CheckGridIntegrity (T *object, bool moved, char const *objType)
 
static TransferAbortParams PlayerCannotEnter (uint32 mapid, Player *player)
 

Public Attributes

std::unordered_map< ObjectGuid::LowType, CreatureGroup * > CreatureGroupHolder
 

Protected Types

typedef std::set< WorldObject * > ActiveNonPlayers
 
typedef std::set< Transport * > TransportsContainer
 

Protected Member Functions

virtual void LoadGridObjects (NGridType *grid, Cell const &cell)
 
- Protected Member Functions inherited from LinkedListHead
 ~LinkedListHead ()
 

Protected Attributes

MapEntry const * i_mapEntry
 
Difficulty i_spawnMode
 
uint32 i_InstanceId
 
uint32 m_unloadTimer
 
float m_VisibleDistance
 
DynamicMapTree _dynamicTree
 
MapRefManager m_mapRefManager
 
MapRefManager::iterator m_mapRefIter
 
int32 m_VisibilityNotifyPeriod
 
ActiveNonPlayers m_activeNonPlayers
 
ActiveNonPlayers::iterator m_activeNonPlayersIter
 
TransportsContainer _transports
 
TransportsContainer::iterator _transportsUpdateIter
 

Private Types

typedef std::multimap< time_t, ScriptActionScriptScheduleMap
 

Private Member Functions

void SetTimer (uint32 t)
 
void SendInitSelf (Player *player)
 
template<typename T >
bool MapObjectCellRelocation (T *object, Cell new_cell, char const *objType)
 
bool CreatureCellRelocation (Creature *creature, Cell new_cell)
 
bool GameObjectCellRelocation (GameObject *go, Cell new_cell)
 
bool DynamicObjectCellRelocation (DynamicObject *go, Cell new_cell)
 
bool AreaTriggerCellRelocation (AreaTrigger *at, Cell new_cell)
 
template<class T >
void InitializeObject (T *obj)
 
void AddCreatureToMoveList (Creature *c, float x, float y, float z, float ang)
 
void RemoveCreatureFromMoveList (Creature *c)
 
void AddGameObjectToMoveList (GameObject *go, float x, float y, float z, float ang)
 
void RemoveGameObjectFromMoveList (GameObject *go)
 
void AddDynamicObjectToMoveList (DynamicObject *go, float x, float y, float z, float ang)
 
void RemoveDynamicObjectFromMoveList (DynamicObject *go)
 
void AddAreaTriggerToMoveList (AreaTrigger *at, float x, float y, float z, float ang)
 
void RemoveAreaTriggerFromMoveList (AreaTrigger *at)
 
bool IsGridLoaded (GridCoord const &) const
 
void EnsureGridCreated (GridCoord const &)
 
bool EnsureGridLoaded (Cell const &)
 
void EnsureGridLoadedForActiveObject (Cell const &, WorldObject const *object)
 
void buildNGridLinkage (NGridType *pNGridType)
 
NGridTypegetNGrid (uint32 x, uint32 y) const
 
bool isGridObjectDataLoaded (uint32 x, uint32 y) const
 
void setGridObjectDataLoaded (bool pLoaded, uint32 x, uint32 y)
 
void setNGrid (NGridType *grid, uint32 x, uint32 y)
 
void ScriptsProcess ()
 Process queued scripts.
 
void SendObjectUpdates ()
 
Player_GetScriptPlayerSourceOrTarget (Object *source, Object *target, ScriptInfo const *scriptInfo) const
 
Creature_GetScriptCreatureSourceOrTarget (Object *source, Object *target, ScriptInfo const *scriptInfo, bool bReverse=false) const
 
GameObject_GetScriptGameObjectSourceOrTarget (Object *source, Object *target, ScriptInfo const *scriptInfo, bool bReverse=false) const
 
Unit_GetScriptUnit (Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
 
Player_GetScriptPlayer (Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
 
Creature_GetScriptCreature (Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
 
WorldObject_GetScriptWorldObject (Object *obj, bool isSource, ScriptInfo const *scriptInfo) const
 
void _ScriptProcessDoor (Object *source, Object *target, ScriptInfo const *scriptInfo) const
 
GameObject_FindGameObject (WorldObject *pWorldObject, ObjectGuid::LowType guid) const
 
void ProcessRelocationNotifies (const uint32 diff)
 
bool CheckRespawn (RespawnInfo *info)
 
void DoRespawn (SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 gridId)
 
bool AddRespawnInfo (RespawnInfo const &info)
 
void UnloadAllRespawnInfos ()
 
RespawnInfoGetRespawnInfo (SpawnObjectType type, ObjectGuid::LowType spawnId) const
 
void Respawn (RespawnInfo *info, CharacterDatabaseTransaction dbTrans=nullptr)
 
void DeleteRespawnInfo (RespawnInfo *info, CharacterDatabaseTransaction dbTrans=nullptr)
 
void DeleteRespawnInfoFromDB (SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr)
 
template<class T >
void AddToGrid (T *object, Cell const &cell)
 
template<class T >
void DeleteFromWorld (T *)
 
void AddToActiveHelper (WorldObject *obj)
 
void RemoveFromActiveHelper (WorldObject *obj)
 
RespawnInfoMapGetRespawnMapForType (SpawnObjectType type)
 
RespawnInfoMap const * GetRespawnMapForType (SpawnObjectType type) const
 
void SetSpawnGroupActive (uint32 groupId, bool state)
 
ObjectGuidGeneratorGetGuidSequenceGenerator (HighGuid high)
 

Private Attributes

bool _creatureToMoveLock
 
std::vector< Creature * > _creaturesToMove
 
bool _gameObjectsToMoveLock
 
std::vector< GameObject * > _gameObjectsToMove
 
bool _dynamicObjectsToMoveLock
 
std::vector< DynamicObject * > _dynamicObjectsToMove
 
bool _areaTriggersToMoveLock
 
std::vector< AreaTrigger * > _areaTriggersToMove
 
time_t i_gridExpiry
 
std::shared_ptr< TerrainInfom_terrain
 
NGridTypei_grids [MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
 
std::bitset< TOTAL_NUMBER_OF_CELLS_PER_MAP *TOTAL_NUMBER_OF_CELLS_PER_MAPmarked_cells
 
bool i_scriptLock
 
std::set< WorldObject * > i_objectsToRemove
 
std::map< WorldObject *, bool > i_objectsToSwitch
 
std::set< WorldObject * > i_worldObjects
 
ScriptScheduleMap m_scriptSchedule
 
std::unique_ptr< RespawnListContainer_respawnTimes
 
RespawnInfoMap _creatureRespawnTimesBySpawnId
 
RespawnInfoMap _gameObjectRespawnTimesBySpawnId
 
std::unordered_set< uint32_toggledSpawnGroupIds
 
uint32 _respawnCheckTimer
 
std::unordered_map< uint32, uint32_zonePlayerCountMap
 
ZoneDynamicInfoMap _zoneDynamicInfo
 
IntervalTimer _weatherUpdateTimer
 
std::map< HighGuid, std::unique_ptr< ObjectGuidGenerator > > _guidGenerators
 
std::unique_ptr< SpawnedPoolData_poolData
 
MapStoredObjectTypesContainer _objectsStore
 
CreatureBySpawnIdContainer _creatureBySpawnIdStore
 
GameObjectBySpawnIdContainer _gameobjectBySpawnIdStore
 
AreaTriggerBySpawnIdContainer _areaTriggerBySpawnIdStore
 
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByCell
 
std::unordered_map< ObjectGuid, Corpse * > _corpsesByPlayer
 
std::unordered_set< Corpse * > _corpseBones
 
std::unordered_set< Object * > _updateObjects
 
MPSCQueue< FarSpellCallback_farSpellCallbacks
 
MultiPersonalPhaseTracker _multiPersonalPhaseTracker
 
WorldStateValueContainer _worldStateValues
 

Friends

class MapReference
 

Detailed Description

Definition at line 186 of file Map.h.

Member Typedef Documentation

◆ ActiveNonPlayers

typedef std::set<WorldObject*> Map::ActiveNonPlayers
protected

Definition at line 598 of file Map.h.

◆ AreaTriggerBySpawnIdContainer

Definition at line 409 of file Map.h.

◆ CreatureBySpawnIdContainer

typedef std::unordered_multimap<ObjectGuid::LowType, Creature*> Map::CreatureBySpawnIdContainer

Definition at line 401 of file Map.h.

◆ FarSpellCallback

typedef std::function<void(Map*)> Map::FarSpellCallback

Definition at line 692 of file Map.h.

◆ GameObjectBySpawnIdContainer

Definition at line 405 of file Map.h.

◆ PlayerList

Definition at line 343 of file Map.h.

◆ ScriptScheduleMap

typedef std::multimap<time_t, ScriptAction> Map::ScriptScheduleMap
private

Definition at line 634 of file Map.h.

◆ TransportsContainer

typedef std::set<Transport*> Map::TransportsContainer
protected

Definition at line 603 of file Map.h.

Constructor & Destructor Documentation

◆ Map()

Map::Map ( uint32  id,
time_t  expiry,
uint32  InstanceId,
Difficulty  SpawnMode 
)

Definition at line 144 of file Map.cpp.

144 :
146i_mapEntry(sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId),
150i_gridExpiry(expiry), m_terrain(sTerrainMgr.LoadTerrain(id)),
151i_scriptLock(false), _respawnTimes(std::make_unique<RespawnListContainer>()), _respawnCheckTimer(0)
152{
153 for (uint32 x = 0; x < MAX_NUMBER_OF_GRIDS; ++x)
154 {
155 for (uint32 y = 0; y < MAX_NUMBER_OF_GRIDS; ++y)
156 {
157 //z code
158 setNGrid(nullptr, x, y);
159 }
160 }
161
162 _zonePlayerCountMap.clear();
163
164 //lets initialize visibility distance for map
166
168
169 GetGuidSequenceGenerator(HighGuid::Transport).Set(sObjectMgr->GetGenerator<HighGuid::Transport>().GetNextAfterMaxUsed());
170
171 _poolData = sPoolMgr->InitPoolsForMap(this);
172
173 sTransportMgr->CreateTransportsForMap(this);
174
175 m_terrain->LoadMMapInstance(GetId(), GetInstanceId());
176
177 _worldStateValues = sWorldStateMgr->GetInitialWorldStatesForMap(this);
178
179 sOutdoorPvPMgr->CreateOutdoorPvPForMap(this);
180 sBattlefieldMgr->CreateBattlefieldsForMap(this);
181
182 sScriptMgr->OnCreateMap(this);
183}
#define sBattlefieldMgr
@ IN_MILLISECONDS
Definition: Common.h:35
DB2Storage< MapEntry > sMapStore("Map.db2", &MapLoadInfo::Instance)
uint32_t uint32
Definition: Define.h:143
#define MAX_NUMBER_OF_GRIDS
Definition: GridDefines.h:38
#define DEFAULT_VISIBILITY_NOTIFY_PERIOD
Definition: NGrid.h:28
#define DEFAULT_VISIBILITY_DISTANCE
Definition: ObjectDefines.h:35
#define sObjectMgr
Definition: ObjectMgr.h:1952
#define sOutdoorPvPMgr
#define sPoolMgr
Definition: PoolMgr.h:179
#define sScriptMgr
Definition: ScriptMgr.h:1418
#define sTerrainMgr
Definition: TerrainMgr.h:165
#define sTransportMgr
Definition: TransportMgr.h:183
#define sWorldStateMgr
Definition: WorldStateMgr.h:50
MapEntry const * i_mapEntry
Definition: Map.h:586
bool _creatureToMoveLock
Definition: Map.h:550
std::unordered_map< uint32, uint32 > _zonePlayerCountMap
Definition: Map.h:762
TransportsContainer::iterator _transportsUpdateIter
Definition: Map.h:605
uint32 m_unloadTimer
Definition: Map.h:589
WorldStateValueContainer _worldStateValues
Definition: Map.h:802
IntervalTimer _weatherUpdateTimer
Definition: Map.h:765
bool _dynamicObjectsToMoveLock
Definition: Map.h:556
std::shared_ptr< TerrainInfo > m_terrain
Definition: Map.h:620
bool _gameObjectsToMoveLock
Definition: Map.h:553
uint32 _respawnCheckTimer
Definition: Map.h:761
time_t i_gridExpiry
Definition: Map.h:618
int32 m_VisibilityNotifyPeriod
Definition: Map.h:596
Difficulty i_spawnMode
Definition: Map.h:587
bool i_scriptLock
Definition: Map.h:629
std::unique_ptr< RespawnListContainer > _respawnTimes
Definition: Map.h:726
bool _areaTriggersToMoveLock
Definition: Map.h:559
ActiveNonPlayers m_activeNonPlayers
Definition: Map.h:599
ObjectGuidGenerator & GetGuidSequenceGenerator(HighGuid high)
Definition: Map.cpp:2490
uint32 GetId() const
Definition: Map.cpp:3175
float m_VisibleDistance
Definition: Map.h:590
virtual void InitVisibilityDistance()
Definition: Map.cpp:185
uint32 GetInstanceId() const
Definition: Map.h:302
TransportsContainer _transports
Definition: Map.h:604
uint32 i_InstanceId
Definition: Map.h:588
ActiveNonPlayers::iterator m_activeNonPlayersIter
Definition: Map.h:600
void setNGrid(NGridType *grid, uint32 x, uint32 y)
Definition: Map.cpp:1920
std::unique_ptr< SpawnedPoolData > _poolData
Definition: Map.h:770
void Set(ObjectGuid::LowType val)
Definition: ObjectGuid.h:402
void SetInterval(time_t interval)
Definition: Timer.h:94
+ Here is the call graph for this function:

◆ ~Map()

Map::~Map ( )
virtual

Definition at line 93 of file Map.cpp.

94{
95 // UnloadAll must be called before deleting the map
96
97 sScriptMgr->OnDestroyMap(this);
98
99 // Delete all waiting spawns, else there will be a memory leak
100 // This doesn't delete from database.
102
103 while (!i_worldObjects.empty())
104 {
105 WorldObject* obj = *i_worldObjects.begin();
106 ASSERT(obj->IsWorldObject());
107 //ASSERT(obj->GetTypeId() == TYPEID_CORPSE);
108 obj->RemoveFromWorld();
109 obj->ResetMap();
110 }
111
112 if (!m_scriptSchedule.empty())
113 sMapMgr->DecreaseScheduledScriptCount(m_scriptSchedule.size());
114
115 sOutdoorPvPMgr->DestroyOutdoorPvPForMap(this);
116 sBattlefieldMgr->DestroyBattlefieldsForMap(this);
117
118 m_terrain->UnloadMMapInstance(GetId(), GetInstanceId());
119}
#define ASSERT
Definition: Errors.h:68
#define sMapMgr
Definition: MapManager.h:183
void UnloadAllRespawnInfos()
Definition: Map.cpp:2119
ScriptScheduleMap m_scriptSchedule
Definition: Map.h:635
std::set< WorldObject * > i_worldObjects
Definition: Map.h:632
virtual void ResetMap()
Definition: Object.cpp:1799
bool IsWorldObject() const
Definition: Object.cpp:903
void RemoveFromWorld() override
Definition: Object.cpp:1008
+ Here is the call graph for this function:

Member Function Documentation

◆ _FindGameObject()

GameObject * Map::_FindGameObject ( WorldObject pWorldObject,
ObjectGuid::LowType  guid 
) const
inlineprivate

Definition at line 302 of file MapScripts.cpp.

303{
304 auto bounds = searchObject->GetMap()->GetGameObjectBySpawnIdStore().equal_range(guid);
305 if (bounds.first == bounds.second)
306 return nullptr;
307
308 return bounds.first->second;
309}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _GetScriptCreature()

Creature * Map::_GetScriptCreature ( Object obj,
bool  isSource,
ScriptInfo const *  scriptInfo 
) const
inlineprivate

Definition at line 222 of file MapScripts.cpp.

223{
224 Creature* creature = nullptr;
225 if (!obj)
226 TC_LOG_ERROR("scripts", "{} {} object is NULL.", scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
227 else
228 {
229 creature = obj->ToCreature();
230 if (!creature)
231 TC_LOG_ERROR("scripts", "{} {} object is not a creature {}.", scriptInfo->GetDebugInfo(),
232 isSource ? "source" : "target", obj->GetGUID().ToString());
233 }
234 return creature;
235}
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
std::string ToString() const
Definition: ObjectGuid.cpp:554
static Creature * ToCreature(Object *o)
Definition: Object.h:206
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:158
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _GetScriptCreatureSourceOrTarget()

Creature * Map::_GetScriptCreatureSourceOrTarget ( Object source,
Object target,
ScriptInfo const *  scriptInfo,
bool  bReverse = false 
) const
inlineprivate

Definition at line 123 of file MapScripts.cpp.

124{
125 Creature* creature = nullptr;
126 if (!source && !target)
127 TC_LOG_ERROR("scripts", "{} source and target objects are NULL.", scriptInfo->GetDebugInfo());
128 else
129 {
130 if (bReverse)
131 {
132 // Check target first, then source.
133 if (target)
134 creature = target->ToCreature();
135 if (!creature && source)
136 creature = source->ToCreature();
137 }
138 else
139 {
140 // Check source first, then target.
141 if (source)
142 creature = source->ToCreature();
143 if (!creature && target)
144 creature = target->ToCreature();
145 }
146
147 if (!creature)
148 TC_LOG_ERROR("scripts", "{} neither source nor target are creatures (source: TypeId: {}, Entry: {}, {}; target: TypeId: {}, Entry: {}, {}), skipping.",
149 scriptInfo->GetDebugInfo().c_str(),
150 source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, (source ? source->GetGUID() : ObjectGuid::Empty).ToString().c_str(),
151 target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, (target ? target->GetGUID() : ObjectGuid::Empty).ToString().c_str());
152 }
153 return creature;
154}
static ObjectGuid const Empty
Definition: ObjectGuid.h:272
TypeID GetTypeId() const
Definition: Object.h:172
uint32 GetEntry() const
Definition: Object.h:160
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _GetScriptGameObjectSourceOrTarget()

GameObject * Map::_GetScriptGameObjectSourceOrTarget ( Object source,
Object target,
ScriptInfo const *  scriptInfo,
bool  bReverse = false 
) const
inlineprivate

Definition at line 156 of file MapScripts.cpp.

157{
158 GameObject* gameobject = nullptr;
159 if (!source && !target)
160 TC_LOG_ERROR("scripts", "{} source and target objects are NULL.", scriptInfo->GetDebugInfo());
161 else
162 {
163 if (bReverse)
164 {
165 // Check target first, then source.
166 if (target)
167 gameobject = target->ToGameObject();
168 if (!gameobject && source)
169 gameobject = source->ToGameObject();
170 }
171 else
172 {
173 // Check source first, then target.
174 if (source)
175 gameobject = source->ToGameObject();
176 if (!gameobject && target)
177 gameobject = target->ToGameObject();
178 }
179
180 if (!gameobject)
181 TC_LOG_ERROR("scripts", "{} neither source nor target are gameobjects (source: TypeId: {}, Entry: {}, {}; target: TypeId: {}, Entry: {}, {}), skipping.",
182 scriptInfo->GetDebugInfo().c_str(),
183 source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, (source ? source->GetGUID() : ObjectGuid::Empty).ToString().c_str(),
184 target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, (target ? target->GetGUID() : ObjectGuid::Empty).ToString().c_str());
185 }
186 return gameobject;
187}
static GameObject * ToGameObject(Object *o)
Definition: Object.h:218
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _GetScriptPlayer()

Player * Map::_GetScriptPlayer ( Object obj,
bool  isSource,
ScriptInfo const *  scriptInfo 
) const
inlineprivate

Definition at line 207 of file MapScripts.cpp.

208{
209 Player* player = nullptr;
210 if (!obj)
211 TC_LOG_ERROR("scripts", "{} {} object is NULL.", scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
212 else
213 {
214 player = obj->ToPlayer();
215 if (!player)
216 TC_LOG_ERROR("scripts", "{} {} object is not a player {}.",
217 scriptInfo->GetDebugInfo(), isSource ? "source" : "target", obj->GetGUID().ToString());
218 }
219 return player;
220}
static Player * ToPlayer(Object *o)
Definition: Object.h:200
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _GetScriptPlayerSourceOrTarget()

Player * Map::_GetScriptPlayerSourceOrTarget ( Object source,
Object target,
ScriptInfo const *  scriptInfo 
) const
inlineprivate

Definition at line 101 of file MapScripts.cpp.

102{
103 Player* player = nullptr;
104 if (!source && !target)
105 TC_LOG_ERROR("scripts", "{} source and target objects are NULL.", scriptInfo->GetDebugInfo());
106 else
107 {
108 // Check target first, then source.
109 if (target)
110 player = target->ToPlayer();
111 if (!player && source)
112 player = source->ToPlayer();
113
114 if (!player)
115 TC_LOG_ERROR("scripts", "{} neither source nor target object is player (source: TypeId: {}, Entry: {}, {}; target: TypeId: {}, Entry: {}, {}), skipping.",
116 scriptInfo->GetDebugInfo().c_str(),
117 source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, (source ? source->GetGUID() : ObjectGuid::Empty).ToString().c_str(),
118 target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, (target ? target->GetGUID() : ObjectGuid::Empty).ToString().c_str());
119 }
120 return player;
121}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _GetScriptUnit()

Unit * Map::_GetScriptUnit ( Object obj,
bool  isSource,
ScriptInfo const *  scriptInfo 
) const
inlineprivate

Definition at line 189 of file MapScripts.cpp.

190{
191 Unit* unit = nullptr;
192 if (!obj)
193 TC_LOG_ERROR("scripts", "{} {} object is NULL.", scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
194 else if (!obj->isType(TYPEMASK_UNIT))
195 TC_LOG_ERROR("scripts", "{} {} object is not unit {}, skipping.",
196 scriptInfo->GetDebugInfo(), isSource ? "source" : "target", obj->GetGUID().ToString());
197 else
198 {
199 unit = obj->ToUnit();
200 if (!unit)
201 TC_LOG_ERROR("scripts", "{} {} object could not be cast to unit.",
202 scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
203 }
204 return unit;
205}
@ TYPEMASK_UNIT
Definition: ObjectGuid.h:60
static Unit * ToUnit(Object *o)
Definition: Object.h:212
bool isType(uint16 mask) const
Definition: Object.h:173
Definition: Unit.h:747
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _GetScriptWorldObject()

WorldObject * Map::_GetScriptWorldObject ( Object obj,
bool  isSource,
ScriptInfo const *  scriptInfo 
) const
inlineprivate

Definition at line 237 of file MapScripts.cpp.

238{
239 WorldObject* pWorldObject = nullptr;
240 if (!obj)
241 TC_LOG_ERROR("scripts", "{} {} object is NULL.",
242 scriptInfo->GetDebugInfo(), isSource ? "source" : "target");
243 else
244 {
245 pWorldObject = dynamic_cast<WorldObject*>(obj);
246 if (!pWorldObject)
247 TC_LOG_ERROR("scripts", "{} {} object is not a world object {}.",
248 scriptInfo->GetDebugInfo(), isSource ? "source" : "target", obj->GetGUID().ToString());
249 }
250 return pWorldObject;
251}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _ScriptProcessDoor()

void Map::_ScriptProcessDoor ( Object source,
Object target,
ScriptInfo const *  scriptInfo 
) const
inlineprivate

Definition at line 253 of file MapScripts.cpp.

254{
255 bool bOpen = false;
256 ObjectGuid::LowType guid = scriptInfo->ToggleDoor.GOGuid;
257 int32 nTimeToToggle = std::max(15, int32(scriptInfo->ToggleDoor.ResetDelay));
258 switch (scriptInfo->command)
259 {
260 case SCRIPT_COMMAND_OPEN_DOOR: bOpen = true; break;
261 case SCRIPT_COMMAND_CLOSE_DOOR: break;
262 default:
263 TC_LOG_ERROR("scripts", "{} unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo());
264 return;
265 }
266 if (!guid)
267 TC_LOG_ERROR("scripts", "{} door guid is not specified.", scriptInfo->GetDebugInfo());
268 else if (!source)
269 TC_LOG_ERROR("scripts", "{} source object is NULL.", scriptInfo->GetDebugInfo());
270 else if (!source->isType(TYPEMASK_UNIT))
271 TC_LOG_ERROR("scripts", "{} source object is not unit {}, skipping.", scriptInfo->GetDebugInfo(),
272 source->GetGUID().ToString());
273 else
274 {
275 WorldObject* wSource = dynamic_cast <WorldObject*> (source);
276 if (!wSource)
277 TC_LOG_ERROR("scripts", "{} source object could not be cast to world object {}, skipping.",
278 scriptInfo->GetDebugInfo(), source->GetGUID().ToString());
279 else
280 {
281 GameObject* pDoor = _FindGameObject(wSource, guid);
282 if (!pDoor)
283 TC_LOG_ERROR("scripts", "{} gameobject was not found (guid: {}).", scriptInfo->GetDebugInfo(), guid);
284 else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR)
285 TC_LOG_ERROR("scripts", "{} gameobject is not a door (GoType: {}, {}).",
286 scriptInfo->GetDebugInfo(), pDoor->GetGoType(), pDoor->GetGUID().ToString());
287 else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY))
288 {
289 pDoor->UseDoorOrButton(nTimeToToggle);
290
291 if (target && target->isType(TYPEMASK_GAMEOBJECT))
292 {
293 GameObject* goTarget = target->ToGameObject();
294 if (goTarget && goTarget->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
295 goTarget->UseDoorOrButton(nTimeToToggle);
296 }
297 }
298 }
299 }
300}
int32_t int32
Definition: Define.h:139
@ TYPEMASK_GAMEOBJECT
Definition: ObjectGuid.h:63
@ SCRIPT_COMMAND_CLOSE_DOOR
Definition: ObjectMgr.h:116
@ SCRIPT_COMMAND_OPEN_DOOR
Definition: ObjectMgr.h:115
@ GAMEOBJECT_TYPE_BUTTON
@ GAMEOBJECT_TYPE_DOOR
@ GO_STATE_READY
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=nullptr)
GOState GetGoState() const
Definition: GameObject.h:262
GameobjectTypes GetGoType() const
Definition: GameObject.h:260
GameObject * _FindGameObject(WorldObject *pWorldObject, ObjectGuid::LowType guid) const
Definition: MapScripts.cpp:302
uint64 LowType
Definition: ObjectGuid.h:276
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ActiveObjectsNearGrid()

bool Map::ActiveObjectsNearGrid ( NGridType const &  ngrid) const

Definition at line 2648 of file Map.cpp.

2649{
2650 CellCoord cell_min(ngrid.getX() * MAX_NUMBER_OF_CELLS, ngrid.getY() * MAX_NUMBER_OF_CELLS);
2651 CellCoord cell_max(cell_min.x_coord + MAX_NUMBER_OF_CELLS, cell_min.y_coord+MAX_NUMBER_OF_CELLS);
2652
2653 //we must find visible range in cells so we unload only non-visible cells...
2654 float viewDist = GetVisibilityRange();
2655 int cell_range = (int)ceilf(viewDist / SIZE_OF_GRID_CELL) + 1;
2656
2657 cell_min.dec_x(cell_range);
2658 cell_min.dec_y(cell_range);
2659 cell_max.inc_x(cell_range);
2660 cell_max.inc_y(cell_range);
2661
2663 {
2664 Player* player = iter->GetSource();
2665
2667 if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
2668 (cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
2669 return true;
2670 }
2671
2672 for (ActiveNonPlayers::const_iterator iter = m_activeNonPlayers.begin(); iter != m_activeNonPlayers.end(); ++iter)
2673 {
2674 WorldObject* obj = *iter;
2675
2677 if ((cell_min.x_coord <= p.x_coord && p.x_coord <= cell_max.x_coord) &&
2678 (cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord))
2679 return true;
2680 }
2681
2682 return false;
2683}
#define MAX_NUMBER_OF_CELLS
Definition: GridDefines.h:36
#define SIZE_OF_GRID_CELL
Definition: GridDefines.h:48
iterator end()
Definition: MapRefManager.h:35
iterator begin()
Definition: MapRefManager.h:34
MapRefManager m_mapRefManager
Definition: Map.h:593
float GetVisibilityRange() const
Definition: Map.h:217
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:206
uint32 x_coord
Definition: GridDefines.h:173
uint32 y_coord
Definition: GridDefines.h:174
float GetPositionX() const
Definition: Position.h:76
float GetPositionY() const
Definition: Position.h:77
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddAreaTriggerToMoveList()

void Map::AddAreaTriggerToMoveList ( AreaTrigger at,
float  x,
float  y,
float  z,
float  ang 
)
private

Definition at line 1221 of file Map.cpp.

1222{
1223 if (_areaTriggersToMoveLock) //can this happen?
1224 return;
1225
1227 _areaTriggersToMove.push_back(at);
1228 at->SetNewCellPosition(x, y, z, ang);
1229}
@ MAP_OBJECT_CELL_MOVE_NONE
Definition: MapObject.h:30
MapObjectCellMoveState _moveState
Definition: MapObject.h:51
void SetNewCellPosition(float x, float y, float z, float o)
Definition: MapObject.h:53
std::vector< AreaTrigger * > _areaTriggersToMove
Definition: Map.h:560
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddCorpse()

void Map::AddCorpse ( Corpse corpse)

Definition at line 3628 of file Map.cpp.

3629{
3630 corpse->SetMap(this);
3631
3632 _corpsesByCell[corpse->GetCellCoord().GetId()].insert(corpse);
3633 if (corpse->GetType() != CORPSE_BONES)
3634 _corpsesByPlayer[corpse->GetOwnerGUID()] = corpse;
3635 else
3636 _corpseBones.insert(corpse);
3637}
@ CORPSE_BONES
Definition: Corpse.h:31
CellCoord const & GetCellCoord() const
Definition: Corpse.h:127
ObjectGuid GetOwnerGUID() const override
Definition: Corpse.h:97
CorpseType GetType() const
Definition: Corpse.h:125
std::unordered_map< ObjectGuid, Corpse * > _corpsesByPlayer
Definition: Map.h:776
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByCell
Definition: Map.h:775
std::unordered_set< Corpse * > _corpseBones
Definition: Map.h:777
virtual void SetMap(Map *map)
Definition: Object.cpp:1781
uint32 GetId() const
Definition: GridDefines.h:166
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddCreatureToMoveList()

void Map::AddCreatureToMoveList ( Creature c,
float  x,
float  y,
float  z,
float  ang 
)
private

Definition at line 1164 of file Map.cpp.

1165{
1166 if (_creatureToMoveLock) //can this happen?
1167 return;
1168
1170 _creaturesToMove.push_back(c);
1171 c->SetNewCellPosition(x, y, z, ang);
1172}
std::vector< Creature * > _creaturesToMove
Definition: Map.h:551
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddDynamicObjectToMoveList()

void Map::AddDynamicObjectToMoveList ( DynamicObject go,
float  x,
float  y,
float  z,
float  ang 
)
private

Definition at line 1202 of file Map.cpp.

1203{
1204 if (_dynamicObjectsToMoveLock) //can this happen?
1205 return;
1206
1207 if (dynObj->_moveState == MAP_OBJECT_CELL_MOVE_NONE)
1208 _dynamicObjectsToMove.push_back(dynObj);
1209 dynObj->SetNewCellPosition(x, y, z, ang);
1210}
std::vector< DynamicObject * > _dynamicObjectsToMove
Definition: Map.h:557
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddFarSpellCallback()

void Map::AddFarSpellCallback ( FarSpellCallback &&  callback)

Definition at line 2499 of file Map.cpp.

2500{
2501 _farSpellCallbacks.Enqueue(new FarSpellCallback(std::move(callback)));
2502}
std::function< void(Map *)> FarSpellCallback
Definition: Map.h:692
MPSCQueue< FarSpellCallback > _farSpellCallbacks
Definition: Map.h:781
+ Here is the caller graph for this function:

◆ AddGameObjectToMoveList()

void Map::AddGameObjectToMoveList ( GameObject go,
float  x,
float  y,
float  z,
float  ang 
)
private

Definition at line 1183 of file Map.cpp.

1184{
1185 if (_gameObjectsToMoveLock) //can this happen?
1186 return;
1187
1189 _gameObjectsToMove.push_back(go);
1190 go->SetNewCellPosition(x, y, z, ang);
1191}
std::vector< GameObject * > _gameObjectsToMove
Definition: Map.h:554
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddObjectToRemoveList()

void Map::AddObjectToRemoveList ( WorldObject obj)

Definition at line 2532 of file Map.cpp.

2533{
2534 ASSERT(obj->GetMapId() == GetId() && obj->GetInstanceId() == GetInstanceId());
2535
2536 obj->SetDestroyedObject(true);
2537 obj->CleanupsBeforeDelete(false); // remove or simplify at least cross referenced links
2538
2539 i_objectsToRemove.insert(obj);
2540}
std::set< WorldObject * > i_objectsToRemove
Definition: Map.h:630
void SetDestroyedObject(bool destroyed)
Definition: Object.h:195
uint32 GetMapId() const
Definition: Position.h:185
uint32 GetInstanceId() const
Definition: Object.h:502
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
Definition: Object.cpp:973
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddObjectToSwitchList()

void Map::AddObjectToSwitchList ( WorldObject obj,
bool  on 
)

Definition at line 2542 of file Map.cpp.

2543{
2544 ASSERT(obj->GetMapId() == GetId() && obj->GetInstanceId() == GetInstanceId());
2545 // i_objectsToSwitch is iterated only in Map::RemoveAllObjectsInRemoveList() and it uses
2546 // the contained objects only if GetTypeId() == TYPEID_UNIT , so we can return in all other cases
2547 if (obj->GetTypeId() != TYPEID_UNIT)
2548 return;
2549
2550 std::map<WorldObject*, bool>::iterator itr = i_objectsToSwitch.find(obj);
2551 if (itr == i_objectsToSwitch.end())
2552 i_objectsToSwitch.insert(itr, std::make_pair(obj, on));
2553 else if (itr->second != on)
2554 i_objectsToSwitch.erase(itr);
2555 else
2556 ABORT();
2557}
#define ABORT
Definition: Errors.h:74
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
std::map< WorldObject *, bool > i_objectsToSwitch
Definition: Map.h:631
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddPlayerToMap()

bool Map::AddPlayerToMap ( Player player,
bool  initPlayer = true 
)
virtual

Reimplemented in GarrisonMap, InstanceMap, and BattlegroundMap.

Definition at line 431 of file Map.cpp.

432{
433 CellCoord cellCoord = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
434 if (!cellCoord.IsCoordValid())
435 {
436 TC_LOG_ERROR("maps", "Map::Add: Player {} has invalid coordinates X:{} Y:{} grid cell [{}:{}]", player->GetGUID().ToString(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
437 return false;
438 }
439
440 Cell cell(cellCoord);
442 AddToGrid(player, cell);
443
444 // Check if we are adding to correct map
445 ASSERT (player->GetMap() == this);
446 player->SetMap(this);
447 player->AddToWorld();
448
449 if (initPlayer)
450 SendInitSelf(player);
451
452 SendInitTransports(player);
453
454 if (initPlayer)
455 player->m_clientGUIDs.clear();
456
457 player->UpdateObjectVisibility(false);
459
460 if (Instanceable())
461 player->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::EnteringInstance);
462
463 if (player->IsAlive())
464 ConvertCorpseToBones(player->GetGUID());
465
466 sScriptMgr->OnPlayerEnterMap(this, player);
467 return true;
468}
Corpse * ConvertCorpseToBones(ObjectGuid const &ownerGuid, bool insignia=false)
Definition: Map.cpp:3659
void EnsureGridLoadedForActiveObject(Cell const &, WorldObject const *object)
Definition: Map.cpp:352
void SendInitSelf(Player *player)
Definition: Map.cpp:1827
bool Instanceable() const
Definition: Map.cpp:3180
void AddToGrid(T *object, Cell const &cell)
Definition: Map.cpp:194
void SendInitTransports(Player *player)
Definition: Map.cpp:1854
static void SendToPlayer(Player const *player, PhaseShift const &phaseShift)
GuidUnorderedSet m_clientGUIDs
Definition: Player.h:2498
void AddToWorld() override
Definition: Player.cpp:1608
void UpdateObjectVisibility(bool forced=true) override
Definition: Player.cpp:23710
void SetMap(Map *map) override
Definition: Player.cpp:27089
bool IsAlive() const
Definition: Unit.h:1273
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition: Unit.cpp:4005
Map * GetMap() const
Definition: Object.h:603
Definition: Cell.h:47
bool IsCoordValid() const
Definition: GridDefines.h:154
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddRespawnInfo()

bool Map::AddRespawnInfo ( RespawnInfo const &  info)
private

Definition at line 2058 of file Map.cpp.

2059{
2060 if (!info.spawnId)
2061 {
2062 TC_LOG_ERROR("maps", "Attempt to insert respawn info for zero spawn id (type {})", uint32(info.type));
2063 return false;
2064 }
2065
2066 RespawnInfoMap* bySpawnIdMap = GetRespawnMapForType(info.type);
2067 if (!bySpawnIdMap)
2068 return false;
2069
2070 // check if we already have the maximum possible number of respawns scheduled
2071 if (SpawnData::TypeHasData(info.type))
2072 {
2073 auto it = bySpawnIdMap->find(info.spawnId);
2074 if (it != bySpawnIdMap->end()) // spawnid already has a respawn scheduled
2075 {
2076 RespawnInfo* const existing = it->second;
2077 if (info.respawnTime <= existing->respawnTime) // delete existing in this case
2078 DeleteRespawnInfo(existing);
2079 else
2080 return false;
2081 }
2082 ASSERT(bySpawnIdMap->find(info.spawnId) == bySpawnIdMap->end(), "Insertion of respawn info with id (%u," UI64FMTD ") into spawn id map failed - state desync.", uint32(info.type), info.spawnId);
2083 }
2084 else
2085 ABORT_MSG("Invalid respawn info for spawn id (%u," UI64FMTD ") being inserted", uint32(info.type), info.spawnId);
2086
2088 ri->handle = _respawnTimes->push(ri);
2089 bySpawnIdMap->emplace(ri->spawnId, ri);
2090 return true;
2091}
#define UI64FMTD
Definition: Define.h:127
#define ABORT_MSG
Definition: Errors.h:75
std::unordered_map< ObjectGuid::LowType, RespawnInfo * > RespawnInfoMap
Definition: Map.h:160
RespawnInfoMap * GetRespawnMapForType(SpawnObjectType type)
Definition: Map.h:729
void DeleteRespawnInfo(RespawnInfo *info, CharacterDatabaseTransaction dbTrans=nullptr)
Definition: Map.cpp:2128
RespawnListContainer::handle_type handle
Definition: Map.cpp:90
ObjectGuid::LowType spawnId
Definition: Map.h:166
time_t respawnTime
Definition: Map.h:168
static constexpr bool TypeHasData(SpawnObjectType type)
Definition: SpawnData.h:85
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToActive()

void Map::AddToActive ( WorldObject obj)

Definition at line 2685 of file Map.cpp.

2686{
2687 AddToActiveHelper(obj);
2688
2689 Optional<Position> respawnLocation;
2690 switch (obj->GetTypeId())
2691 {
2692 case TYPEID_UNIT:
2693 if (Creature* creature = obj->ToCreature(); !creature->IsPet() && creature->GetSpawnId())
2694 {
2695 respawnLocation.emplace();
2696 creature->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ);
2697 }
2698 break;
2699 case TYPEID_GAMEOBJECT:
2700 if (GameObject* gameObject = obj->ToGameObject(); gameObject->GetSpawnId())
2701 {
2702 respawnLocation.emplace();
2703 gameObject->GetRespawnPosition(respawnLocation->m_positionX, respawnLocation->m_positionY, respawnLocation->m_positionZ);
2704 }
2705 break;
2706 default:
2707 break;
2708 }
2709
2710 if (respawnLocation)
2711 {
2712 GridCoord p = Trinity::ComputeGridCoord(respawnLocation->GetPositionX(), respawnLocation->GetPositionY());
2713 if (getNGrid(p.x_coord, p.y_coord))
2715 else
2716 {
2718 TC_LOG_ERROR("maps", "Active object {} added to grid[{}, {}] but spawn grid[{}, {}] was not loaded.",
2719 obj->GetGUID().ToString(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord);
2720 }
2721 }
2722}
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:43
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
ObjectGuid::LowType GetSpawnId() const
Definition: GameObject.h:194
NGridType * getNGrid(uint32 x, uint32 y) const
Definition: Map.h:569
void AddToActiveHelper(WorldObject *obj)
Definition: Map.h:705
void incUnloadActiveLock()
Definition: NGrid.h:107
bool IsPet() const
Definition: Unit.h:860
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:194
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToActiveHelper()

void Map::AddToActiveHelper ( WorldObject obj)
inlineprivate

Definition at line 705 of file Map.h.

706 {
707 m_activeNonPlayers.insert(obj);
708 }
+ Here is the caller graph for this function:

◆ AddToGrid() [1/6]

template<>
void Map::AddToGrid ( AreaTrigger obj,
Cell const &  cell 
)

Definition at line 237 of file Map.cpp.

238{
239 NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
240 grid->GetGridType(cell.CellX(), cell.CellY()).AddGridObject(obj);
241
242 obj->SetCurrentCell(cell);
243}
void AddGridObject(SPECIFIC_OBJECT *obj)
Definition: Grid.h:111
void SetCurrentCell(Cell const &cell)
Definition: MapObject.h:49
Definition: NGrid.h:70
GridType & GetGridType(const uint32 x, const uint32 y)
Definition: NGrid.h:78
+ Here is the call graph for this function:

◆ AddToGrid() [2/6]

template<>
void Map::AddToGrid ( Corpse obj,
Cell const &  cell 
)

Definition at line 246 of file Map.cpp.

247{
248 NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
249 // Corpses are a special object type - they can be added to grid via a call to AddToMap
250 // or loaded through ObjectGridLoader.
251 // Both corpses loaded from database and these freshly generated by Player::CreateCoprse are added to _corpsesByCell
252 // ObjectGridLoader loads all corpses from _corpsesByCell even if they were already added to grid before it was loaded
253 // so we need to explicitly check it here (Map::AddToGrid is only called from Player::BuildPlayerRepop, not from ObjectGridLoader)
254 // to avoid failing an assertion in GridObject::AddToGrid
255 if (grid->isGridObjectDataLoaded())
256 {
257 if (obj->IsWorldObject())
258 grid->GetGridType(cell.CellX(), cell.CellY()).AddWorldObject(obj);
259 else
260 grid->GetGridType(cell.CellX(), cell.CellY()).AddGridObject(obj);
261 }
262}
void AddWorldObject(SPECIFIC_OBJECT *obj)
Definition: Grid.h:58
bool isGridObjectDataLoaded() const
Definition: NGrid.h:100
+ Here is the call graph for this function:

◆ AddToGrid() [3/6]

template<>
void Map::AddToGrid ( Creature obj,
Cell const &  cell 
)

Definition at line 204 of file Map.cpp.

205{
206 NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
207 if (obj->IsWorldObject())
208 grid->GetGridType(cell.CellX(), cell.CellY()).AddWorldObject(obj);
209 else
210 grid->GetGridType(cell.CellX(), cell.CellY()).AddGridObject(obj);
211
212 obj->SetCurrentCell(cell);
213}
+ Here is the call graph for this function:

◆ AddToGrid() [4/6]

template<>
void Map::AddToGrid ( DynamicObject obj,
Cell const &  cell 
)

Definition at line 225 of file Map.cpp.

226{
227 NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
228 if (obj->IsWorldObject())
229 grid->GetGridType(cell.CellX(), cell.CellY()).AddWorldObject(obj);
230 else
231 grid->GetGridType(cell.CellX(), cell.CellY()).AddGridObject(obj);
232
233 obj->SetCurrentCell(cell);
234}
+ Here is the call graph for this function:

◆ AddToGrid() [5/6]

template<>
void Map::AddToGrid ( GameObject obj,
Cell const &  cell 
)

Definition at line 216 of file Map.cpp.

217{
218 NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
219 grid->GetGridType(cell.CellX(), cell.CellY()).AddGridObject(obj);
220
221 obj->SetCurrentCell(cell);
222}
+ Here is the call graph for this function:

◆ AddToGrid() [6/6]

template<class T >
void Map::AddToGrid ( T *  object,
Cell const &  cell 
)
private

Definition at line 194 of file Map.cpp.

195{
196 NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
197 if (obj->IsWorldObject())
198 grid->GetGridType(cell.CellX(), cell.CellY()).template AddWorldObject<T>(obj);
199 else
200 grid->GetGridType(cell.CellX(), cell.CellY()).template AddGridObject<T>(obj);
201}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToMap() [1/2]

template<class T >
bool Map::AddToMap ( T *  obj)
Todo:
Needs clean up. An object should not be added to map twice.

Definition at line 534 of file Map.cpp.

535{
537 if (obj->IsInWorld())
538 {
539 ASSERT(obj->IsInGrid());
540 obj->UpdateObjectVisibility(true);
541 return true;
542 }
543
544 CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
545 //It will create many problems (including crashes) if an object is not added to grid after creation
546 //The correct way to fix it is to make AddToMap return false and delete the object if it is not added to grid
547 //But now AddToMap is used in too many places, I will just see how many ASSERT failures it will cause
548 ASSERT(cellCoord.IsCoordValid());
549 if (!cellCoord.IsCoordValid())
550 {
551 TC_LOG_ERROR("maps", "Map::Add: Object {} has invalid coordinates X:{} Y:{} grid cell [{}:{}]", obj->GetGUID().ToString(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
552 return false; //Should delete object
553 }
554
555 Cell cell(cellCoord);
556 if (obj->isActiveObject())
558 else
559 EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
560 AddToGrid(obj, cell);
561 TC_LOG_DEBUG("maps", "Object {} enters grid[{}, {}]", obj->GetGUID().ToString(), cell.GridX(), cell.GridY());
562
563 //Must already be set before AddToMap. Usually during obj->Create.
564 //obj->SetMap(this);
565 obj->AddToWorld();
566
567 InitializeObject(obj);
568
569 if (obj->isActiveObject())
570 AddToActive(obj);
571
572 //something, such as vehicle, needs to be update immediately
573 //also, trigger needs to cast spell, if not update, cannot see visual
574 obj->SetIsNewObject(true);
575 obj->UpdateObjectVisibilityOnCreate();
576 obj->SetIsNewObject(false);
577 return true;
578}
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
Definition: GridDefines.h:177
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:156
void InitializeObject(T *obj)
Definition: Map.cpp:519
void EnsureGridCreated(GridCoord const &)
Definition: Map.cpp:329
void AddToActive(WorldObject *obj)
Definition: Map.cpp:2685
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToMap() [2/2]

template<>
bool Map::AddToMap ( Transport obj)

Definition at line 581 of file Map.cpp.

582{
583 //TODO: Needs clean up. An object should not be added to map twice.
584 if (obj->IsInWorld())
585 return true;
586
588 if (!cellCoord.IsCoordValid())
589 {
590 TC_LOG_ERROR("maps", "Map::Add: Object {} has invalid coordinates X:{} Y:{} grid cell [{}:{}]", obj->GetGUID().ToString(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
591 return false; //Should delete object
592 }
593
594 _transports.insert(obj);
595
596 if (obj->GetExpectedMapId() == GetId())
597 {
598 obj->AddToWorld();
599
600 // Broadcast creation to players
601 for (Map::PlayerList::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
602 {
603 if (itr->GetSource()->GetTransport() != obj && itr->GetSource()->InSamePhase(obj))
604 {
605 UpdateData data(GetId());
606 obj->BuildCreateUpdateBlockForPlayer(&data, itr->GetSource());
607 itr->GetSource()->m_visibleTransports.insert(obj->GetGUID());
608 WorldPacket packet;
609 data.BuildPacket(&packet);
610 itr->GetSource()->SendDirectMessage(&packet);
611 }
612 }
613 }
614
615 return true;
616}
void AddToWorld() override
Definition: GameObject.cpp:661
PlayerList const & GetPlayers() const
Definition: Map.h:344
bool IsInWorld() const
Definition: Object.h:153
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:130
uint32 GetExpectedMapId() const
Returns id of the map that transport is expected to be on, according to current path progress.
Definition: Transport.cpp:736
bool InSamePhase(PhaseShift const &phaseShift) const
Definition: Object.h:508
+ Here is the call graph for this function:

◆ AddUpdateObject()

void Map::AddUpdateObject ( Object obj)
inline

Definition at line 509 of file Map.h.

510 {
511 _updateObjects.insert(obj);
512 }
std::unordered_set< Object * > _updateObjects
Definition: Map.h:779
+ Here is the caller graph for this function:

◆ AddWorldObject()

void Map::AddWorldObject ( WorldObject obj)
inline

Definition at line 338 of file Map.h.

338{ i_worldObjects.insert(obj); }
+ Here is the caller graph for this function:

◆ ApplyDynamicModeRespawnScaling()

void Map::ApplyDynamicModeRespawnScaling ( WorldObject const *  obj,
ObjectGuid::LowType  spawnId,
uint32 respawnDelay,
uint32  mode 
) const

Definition at line 2243 of file Map.cpp.

2244{
2245 ASSERT(mode == 1);
2246 ASSERT(obj->GetMap() == this);
2247
2249 return;
2250
2251 SpawnObjectType type;
2252 switch (obj->GetTypeId())
2253 {
2254 case TYPEID_UNIT:
2255 type = SPAWN_TYPE_CREATURE;
2256 break;
2257 case TYPEID_GAMEOBJECT:
2258 type = SPAWN_TYPE_GAMEOBJECT;
2259 break;
2260 default:
2261 return;
2262 }
2263
2264 SpawnMetadata const* data = sObjectMgr->GetSpawnMetadata(type, spawnId);
2265 if (!data)
2266 return;
2267
2269 return;
2270
2271 auto it = _zonePlayerCountMap.find(obj->GetZoneId());
2272 if (it == _zonePlayerCountMap.end())
2273 return;
2274 uint32 const playerCount = it->second;
2275 if (!playerCount)
2276 return;
2277 double const adjustFactor = sWorld->getFloatConfig(type == SPAWN_TYPE_GAMEOBJECT ? CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT : CONFIG_RESPAWN_DYNAMICRATE_CREATURE) / playerCount;
2278 if (adjustFactor >= 1.0) // nothing to do here
2279 return;
2281 if (respawnDelay <= timeMinimum)
2282 return;
2283
2284 respawnDelay = std::max<uint32>(ceil(respawnDelay * adjustFactor), timeMinimum);
2285}
@ SPAWNGROUP_FLAG_DYNAMIC_SPAWN_RATE
Definition: SpawnData.h:57
SpawnObjectType
Definition: SpawnData.h:33
@ SPAWN_TYPE_GAMEOBJECT
Definition: SpawnData.h:35
@ SPAWN_TYPE_CREATURE
Definition: SpawnData.h:34
bool IsBattlegroundOrArena() const
Definition: Map.cpp:3222
#define sWorld
Definition: World.h:962
@ CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE
Definition: World.h:429
@ CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT
Definition: World.h:430
@ CONFIG_RESPAWN_DYNAMICRATE_CREATURE
Definition: World.h:220
@ CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT
Definition: World.h:221
SpawnGroupFlags flags
Definition: SpawnData.h:70
SpawnGroupTemplateData const * spawnGroupData
Definition: SpawnData.h:96
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AreaTriggerCellRelocation()

bool Map::AreaTriggerCellRelocation ( AreaTrigger at,
Cell  new_cell 
)
private

Definition at line 1500 of file Map.cpp.

1501{
1502 return MapObjectCellRelocation(at, new_cell, "AreaTrigger");
1503}
bool MapObjectCellRelocation(T *object, Cell new_cell, char const *objType)
Definition: Map.cpp:1420
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AreaTriggerRelocation()

void Map::AreaTriggerRelocation ( AreaTrigger at,
float  x,
float  y,
float  z,
float  orientation 
)

Definition at line 1134 of file Map.cpp.

1135{
1136 ASSERT(CheckGridIntegrity(at, false, "AreaTrigger"));
1137 Cell new_cell(x, y);
1138
1139 if (!getNGrid(new_cell.GridX(), new_cell.GridY()))
1140 return;
1141
1142 Cell old_cell = at->GetCurrentCell();
1143
1144 // delay areatrigger move for grid/cell to grid/cell moves
1145 if (old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell))
1146 {
1147#ifdef TRINITY_DEBUG
1148 TC_LOG_DEBUG("maps", "AreaTrigger ({}) added to moving list from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", at->GetGUID().ToString(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
1149#endif
1150 AddAreaTriggerToMoveList(at, x, y, z, orientation);
1151 // in diffcell/diffgrid case notifiers called at finishing move at in Map::MoveAllAreaTriggersInMoveList
1152 }
1153 else
1154 {
1155 at->Relocate(x, y, z, orientation);
1156 at->UpdateShape();
1157 at->UpdateObjectVisibility(false);
1159 }
1160
1161 ASSERT(CheckGridIntegrity(at, true, "AreaTrigger"));
1162}
void UpdateShape()
Cell const & GetCurrentCell() const
Definition: MapObject.h:48
void RemoveAreaTriggerFromMoveList(AreaTrigger *at)
Definition: Map.cpp:1231
void AddAreaTriggerToMoveList(AreaTrigger *at, float x, float y, float z, float ang)
Definition: Map.cpp:1221
static bool CheckGridIntegrity(T *object, bool moved, char const *objType)
Definition: Map.cpp:999
virtual void UpdateObjectVisibility(bool forced=true)
Definition: Object.cpp:3624
uint32 GridX() const
Definition: Cell.h:73
uint32 GridY() const
Definition: Cell.h:74
bool DiffGrid(Cell const &cell) const
Definition: Cell.h:65
bool DiffCell(Cell const &cell) const
Definition: Cell.h:59
uint32 CellX() const
Definition: Cell.h:71
uint32 CellY() const
Definition: Cell.h:72
void Relocate(float x, float y)
Definition: Position.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Balance()

void Map::Balance ( )
inline

Definition at line 438 of file Map.h.

DynamicMapTree _dynamicTree
Definition: Map.h:591
+ Here is the caller graph for this function:

◆ buildNGridLinkage()

void Map::buildNGridLinkage ( NGridType pNGridType)
inlineprivate

Definition at line 567 of file Map.h.

567{ pNGridType->link(this); }
void link(GridRefManager< NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > *pTo)
Definition: NGrid.h:96
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CannotEnter()

virtual TransferAbortParams Map::CannotEnter ( Player )
inlinevirtual

Reimplemented in InstanceMap, and BattlegroundMap.

Definition at line 305 of file Map.h.

305{ return { TRANSFER_ABORT_NONE }; }
@ TRANSFER_ABORT_NONE
Definition: Map.h:85
+ Here is the caller graph for this function:

◆ CanUnload()

bool Map::CanUnload ( uint32  diff)
inline

Definition at line 196 of file Map.h.

197 {
198 if (!m_unloadTimer)
199 return false;
200
201 if (m_unloadTimer <= diff)
202 return true;
203
204 m_unloadTimer -= diff;
205 return false;
206 }

◆ CheckGridIntegrity()

template<typename T >
bool Map::CheckGridIntegrity ( T *  object,
bool  moved,
char const *  objType 
)
static

Definition at line 999 of file Map.cpp.

1000{
1001 Cell const& cur_cell = object->GetCurrentCell();
1002 Cell xy_cell(object->GetPositionX(), object->GetPositionY());
1003 if (xy_cell != cur_cell)
1004 {
1005 TC_LOG_DEBUG("maps", "{} {} X: {} Y: {} ({}) is in grid[{}, {}]cell[{}, {}] instead of grid[{}, {}]cell[{}, {}]",
1006 objType, object->GetGUID().ToString(),
1007 object->GetPositionX(), object->GetPositionY(), (moved ? "final" : "original"),
1008 cur_cell.GridX(), cur_cell.GridY(), cur_cell.CellX(), cur_cell.CellY(),
1009 xy_cell.GridX(), xy_cell.GridY(), xy_cell.CellX(), xy_cell.CellY());
1010 return true; // not crash at error, just output error in debug mode
1011 }
1012
1013 return true;
1014}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckRespawn()

bool Map::CheckRespawn ( RespawnInfo info)
private

Definition at line 1955 of file Map.cpp.

1956{
1957 SpawnData const* data = sObjectMgr->GetSpawnData(info->type, info->spawnId);
1958 ASSERT(data, "Invalid respawn info with type %u, spawnID " UI64FMTD " in respawn queue.", info->type, info->spawnId);
1959
1960 // First, check if this creature's spawn group is inactive
1962 {
1963 info->respawnTime = 0;
1964 return false;
1965 }
1966
1967 // Next, check if there's already an instance of this object that would block the respawn
1968 bool alreadyExists = false;
1969 switch (info->type)
1970 {
1972 {
1973 // escort check for creatures only (if the world config boolean is set)
1974 bool const isEscort = (sWorld->getBoolConfig(CONFIG_RESPAWN_DYNAMIC_ESCORTNPC) && data->spawnGroupData->flags & SPAWNGROUP_FLAG_ESCORTQUESTNPC);
1975
1976 auto range = _creatureBySpawnIdStore.equal_range(info->spawnId);
1977 for (auto it = range.first; it != range.second; ++it)
1978 {
1979 Creature* creature = it->second;
1980 if (!creature->IsAlive())
1981 continue;
1982 // escort NPCs are allowed to respawn as long as all other instances are already escorting
1983 if (isEscort && creature->IsEscorted())
1984 continue;
1985 alreadyExists = true;
1986 break;
1987 }
1988 break;
1989 }
1991 // gameobject check is simpler - they cannot be dead or escorting
1993 alreadyExists = true;
1994 break;
1995 default:
1996 ABORT_MSG("Invalid spawn type %u with spawnId " UI64FMTD " on map %u", uint32(info->type), info->spawnId, GetId());
1997 return true;
1998 }
1999 if (alreadyExists)
2000 {
2001 info->respawnTime = 0;
2002 return false;
2003 }
2004
2005 // next, check linked respawn time
2006 ObjectGuid thisGUID = info->type == SPAWN_TYPE_GAMEOBJECT
2007 ? ObjectGuid::Create<HighGuid::GameObject>(GetId(), info->entry, info->spawnId)
2008 : ObjectGuid::Create<HighGuid::Creature>(GetId(), info->entry, info->spawnId);
2009 if (time_t linkedTime = GetLinkedRespawnTime(thisGUID))
2010 {
2011 time_t now = GameTime::GetGameTime();
2012 time_t respawnTime;
2013 if (linkedTime == std::numeric_limits<time_t>::max())
2014 respawnTime = linkedTime;
2015 else if (sObjectMgr->GetLinkedRespawnGuid(thisGUID) == thisGUID) // never respawn, save "something" in DB
2016 respawnTime = now + WEEK;
2017 else // set us to check again shortly after linked unit
2018 respawnTime = std::max<time_t>(now, linkedTime) + urand(5, 15);
2019 info->respawnTime = respawnTime;
2020 return false;
2021 }
2022 // everything ok, let's spawn
2023 return true;
2024}
@ WEEK
Definition: Common.h:32
HighGuid
Definition: ObjectGuid.h:73
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ SPAWNGROUP_FLAG_ESCORTQUESTNPC
Definition: SpawnData.h:58
bool IsEscorted() const
Definition: Creature.cpp:3572
time_t GetLinkedRespawnTime(ObjectGuid guid) const
Definition: Map.cpp:3519
bool IsSpawnGroupActive(uint32 groupId) const
Definition: Map.cpp:2442
CreatureBySpawnIdContainer _creatureBySpawnIdStore
Definition: Map.h:772
GameObjectBySpawnIdContainer _gameobjectBySpawnIdStore
Definition: Map.h:773
@ CONFIG_RESPAWN_DYNAMIC_ESCORTNPC
Definition: World.h:194
time_t GetGameTime()
Definition: GameTime.cpp:39
uint32 entry
Definition: Map.h:167
SpawnObjectType type
Definition: Map.h:165
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ContainsGameObjectModel()

bool Map::ContainsGameObjectModel ( GameObjectModel const &  model) const
inline

Definition at line 441 of file Map.h.

441{ return _dynamicTree.contains(model);}
bool contains(GameObjectModel const &) const

◆ ConvertCorpseToBones()

Corpse * Map::ConvertCorpseToBones ( ObjectGuid const &  ownerGuid,
bool  insignia = false 
)

Definition at line 3659 of file Map.cpp.

3660{
3661 Corpse* corpse = GetCorpseByPlayer(ownerGuid);
3662 if (!corpse)
3663 return nullptr;
3664
3665 RemoveCorpse(corpse);
3666
3667 // remove corpse from DB
3668 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
3669 corpse->DeleteFromDB(trans);
3670 CharacterDatabase.CommitTransaction(trans);
3671
3672 Corpse* bones = nullptr;
3673
3674 // create the bones only if the map and the grid is loaded at the corpse's location
3675 // ignore bones creating option in case insignia
3676 if ((insignia ||
3678 !IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY()))
3679 {
3680 // Create bones, don't change Corpse
3681 bones = new Corpse();
3682 bones->Create(corpse->GetGUID().GetCounter(), this);
3683
3685 bones->SetOwnerGUID(corpse->m_corpseData->Owner);
3686 bones->SetPartyGUID(corpse->m_corpseData->PartyGUID);
3687 bones->SetGuildGUID(corpse->m_corpseData->GuildGUID);
3688 bones->SetDisplayId(corpse->m_corpseData->DisplayID);
3689 bones->SetRace(corpse->m_corpseData->RaceID);
3690 bones->SetSex(corpse->m_corpseData->Sex);
3691 bones->SetClass(corpse->m_corpseData->Class);
3692 bones->SetCustomizations(Trinity::Containers::MakeIteratorPair(corpse->m_corpseData->Customizations.begin(), corpse->m_corpseData->Customizations.end()));
3693 bones->ReplaceAllFlags(corpse->m_corpseData->Flags | CORPSE_FLAG_BONES);
3694 bones->SetFactionTemplate(corpse->m_corpseData->FactionTemplate);
3695
3696 bones->SetCellCoord(corpse->GetCellCoord());
3697 bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());
3698
3699 PhasingHandler::InheritPhaseShift(bones, corpse);
3700
3701 AddCorpse(bones);
3702
3703 bones->UpdatePositionData();
3704 bones->SetZoneScript();
3705
3706 // add bones in grid store if grid loaded where corpse placed
3707 AddToMap(bones);
3708 }
3709
3710 // all references to the corpse should be removed at this point
3711 delete corpse;
3712
3713 return bones;
3714}
@ CORPSE_FLAG_BONES
Definition: Corpse.h:43
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Corpse.h:53
void ReplaceAllFlags(uint32 flags)
Definition: Corpse.h:105
void SetRace(uint8 race)
Definition: Corpse.h:102
void SetClass(uint8 playerClass)
Definition: Corpse.h:103
void SetSex(uint8 sex)
Definition: Corpse.h:104
void SetGuildGUID(ObjectGuid guildGuid)
Definition: Corpse.h:100
void SetDisplayId(uint32 displayId)
Definition: Corpse.h:101
void SetCustomizations(Trinity::IteratorPair< Iter > customizations)
Definition: Corpse.h:112
CorpseDynFlags GetCorpseDynamicFlags() const
Definition: Corpse.h:92
void SetFactionTemplate(int32 factionTemplate)
Definition: Corpse.h:106
void SetOwnerGUID(ObjectGuid owner)
Definition: Corpse.h:98
void SetPartyGUID(ObjectGuid partyGuid)
Definition: Corpse.h:99
UF::UpdateField< UF::CorpseData, 0, TYPEID_CORPSE > m_corpseData
Definition: Corpse.h:137
void ReplaceAllCorpseDynamicFlags(CorpseDynFlags dynamicFlags)
Definition: Corpse.h:95
void SetCellCoord(CellCoord const &cellCoord)
Definition: Corpse.h:128
bool Create(ObjectGuid::LowType guidlow, Map *map)
Definition: Corpse.cpp:65
void DeleteFromDB(CharacterDatabaseTransaction trans)
Definition: Corpse.cpp:156
bool AddToMap(T *)
Definition: Map.cpp:534
void AddCorpse(Corpse *corpse)
Definition: Map.cpp:3628
bool IsRemovalGrid(float x, float y) const
Definition: Map.h:230
Corpse * GetCorpseByPlayer(ObjectGuid const &ownerGuid) const
Definition: Map.h:422
void RemoveCorpse(Corpse *corpse)
Definition: Map.cpp:3639
LowType GetCounter() const
Definition: ObjectGuid.h:291
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
void SetZoneScript()
Definition: Object.cpp:1998
void UpdatePositionData()
Definition: Object.cpp:984
@ CONFIG_DEATH_BONES_BG_OR_ARENA
Definition: World.h:132
@ CONFIG_DEATH_BONES_WORLD
Definition: World.h:131
constexpr IteratorPair< iterator, end_iterator > MakeIteratorPair(iterator first, end_iterator second)
Definition: IteratorPair.h:48
float GetPositionZ() const
Definition: Position.h:78
float GetOrientation() const
Definition: Position.h:79
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreatureCellRelocation()

bool Map::CreatureCellRelocation ( Creature creature,
Cell  new_cell 
)
private

Definition at line 1485 of file Map.cpp.

1486{
1487 return MapObjectCellRelocation(c, new_cell, "Creature");
1488}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreatureRelocation()

void Map::CreatureRelocation ( Creature creature,
float  x,
float  y,
float  z,
float  ang,
bool  respawnRelocationOnFail = true 
)

Definition at line 1043 of file Map.cpp.

1044{
1045 ASSERT(CheckGridIntegrity(creature, false, "Creature"));
1046
1047 Cell new_cell(x, y);
1048
1049 if (!respawnRelocationOnFail && !getNGrid(new_cell.GridX(), new_cell.GridY()))
1050 return;
1051
1052 Cell old_cell = creature->GetCurrentCell();
1053 // delay creature move for grid/cell to grid/cell moves
1054 if (old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell))
1055 {
1056#ifdef TRINITY_DEBUG
1057 TC_LOG_DEBUG("maps", "Creature {} added to moving list from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", creature->GetGUID().ToString(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
1058#endif
1059 AddCreatureToMoveList(creature, x, y, z, ang);
1060 // in diffcell/diffgrid case notifiers called at finishing move creature in Map::MoveAllCreaturesInMoveList
1061 }
1062 else
1063 {
1064 creature->Relocate(x, y, z, ang);
1065 if (creature->IsVehicle())
1066 creature->GetVehicleKit()->RelocatePassengers();
1067 creature->UpdateObjectVisibility(false);
1068 creature->UpdatePositionData();
1070 }
1071
1072 ASSERT(CheckGridIntegrity(creature, true, "Creature"));
1073}
void RemoveCreatureFromMoveList(Creature *c)
Definition: Map.cpp:1174
void AddCreatureToMoveList(Creature *c, float x, float y, float z, float ang)
Definition: Map.cpp:1164
bool IsVehicle() const
Definition: Unit.h:863
void UpdateObjectVisibility(bool forced=true) override
Definition: Unit.cpp:11893
Vehicle * GetVehicleKit() const
Definition: Unit.h:1816
void RelocatePassengers()
Relocate passengers. Must be called after m_base::Relocate.
Definition: Vehicle.cpp:553
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreatureRespawnRelocation()

bool Map::CreatureRespawnRelocation ( Creature c,
bool  diffGridOnly 
)

Definition at line 1505 of file Map.cpp.

1506{
1507 float resp_x, resp_y, resp_z, resp_o;
1508 c->GetRespawnPosition(resp_x, resp_y, resp_z, &resp_o);
1509 Cell resp_cell(resp_x, resp_y);
1510
1511 //creature will be unloaded with grid
1512 if (diffGridOnly && !c->GetCurrentCell().DiffGrid(resp_cell))
1513 return true;
1514
1515 c->CombatStop();
1516 c->GetMotionMaster()->Clear();
1517
1518#ifdef TRINITY_DEBUG
1519 TC_LOG_DEBUG("maps", "Creature {} moved from grid[{}, {}]cell[{}, {}] to respawn grid[{}, {}]cell[{}, {}].", c->GetGUID().ToString(), c->GetCurrentCell().GridX(), c->GetCurrentCell().GridY(), c->GetCurrentCell().CellX(), c->GetCurrentCell().CellY(), resp_cell.GridX(), resp_cell.GridY(), resp_cell.CellX(), resp_cell.CellY());
1520#endif
1521
1522 // teleport it to respawn point (like normal respawn if player see)
1523 if (CreatureCellRelocation(c, resp_cell))
1524 {
1525 c->Relocate(resp_x, resp_y, resp_z, resp_o);
1526 c->GetMotionMaster()->Initialize(); // prevent possible problems with default move generators
1527 //CreatureRelocationNotify(c, resp_cell, resp_cell.GetCellCoord());
1528 c->UpdatePositionData();
1529 c->UpdateObjectVisibility(false);
1530 return true;
1531 }
1532
1533 return false;
1534}
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr, float *dist=nullptr) const
Definition: Creature.cpp:2809
bool CreatureCellRelocation(Creature *creature, Cell new_cell)
Definition: Map.cpp:1485
void Initialize()
MotionMaster * GetMotionMaster()
Definition: Unit.h:1757
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition: Unit.cpp:5732
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DelayedUpdate()

void Map::DelayedUpdate ( uint32  diff)
virtual

Definition at line 2504 of file Map.cpp.

2505{
2506 {
2507 FarSpellCallback* callback;
2508 while (_farSpellCallbacks.Dequeue(callback))
2509 {
2510 (*callback)(this);
2511 delete callback;
2512 }
2513 }
2514
2516
2517 // Don't unload grids if it's battleground, since we may have manually added GOs, creatures, those doesn't load from DB at grid re-load !
2518 // This isn't really bother us, since as soon as we have instanced BG-s, the whole map unloads as the BG gets ended
2519 if (!IsBattlegroundOrArena())
2520 {
2522 {
2523 NGridType *grid = i->GetSource();
2524 GridInfo* info = i->GetSource()->getGridInfoRef();
2525 ++i; // The update might delete the map and we need the next map before the iterator gets invalid
2526 ASSERT(grid->GetGridState() >= 0 && grid->GetGridState() < MAX_GRID_STATE);
2527 si_GridStates[grid->GetGridState()]->Update(*this, *grid, *info, t_diff);
2528 }
2529 }
2530}
GridState * si_GridStates[MAX_GRID_STATE]
Definition: Map.cpp:72
@ MAX_GRID_STATE
Definition: NGrid.h:59
Definition: NGrid.h:31
iterator end()
virtual void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const =0
void RemoveAllObjectsInRemoveList()
Definition: Map.cpp:2559
grid_state_t GetGridState(void) const
Definition: NGrid.h:91
+ Here is the call graph for this function:

◆ DeleteCorpseData()

void Map::DeleteCorpseData ( )

Definition at line 3619 of file Map.cpp.

3620{
3621 // DELETE cp, c FROM corpse_phases cp INNER JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ? AND c.instanceId = ?
3623 stmt->setUInt32(0, GetId());
3624 stmt->setUInt32(1, GetInstanceId());
3625 CharacterDatabase.Execute(stmt);
3626}
@ CHAR_DEL_CORPSES_FROM_MAP
void setUInt32(const uint8 index, const uint32 value)
+ Here is the call graph for this function:

◆ DeleteFromWorld() [1/2]

template<>
void Map::DeleteFromWorld ( Player player)
Todo:
I do not know why we need this, it should be removed in ~Object anyway

Definition at line 320 of file Map.cpp.

321{
323 RemoveUpdateObject(player);
324 delete player;
325}
void RemoveUpdateObject(Object *obj)
Definition: Map.h:514
void RemoveObject(T *object)
+ Here is the call graph for this function:

◆ DeleteFromWorld() [2/2]

template<class T >
void Map::DeleteFromWorld ( T *  obj)
private

Definition at line 313 of file Map.cpp.

314{
315 // Note: In case resurrectable corpse and pet its removed from global lists in own destructor
316 delete obj;
317}
+ Here is the caller graph for this function:

◆ DeleteRespawnInfo()

void Map::DeleteRespawnInfo ( RespawnInfo info,
CharacterDatabaseTransaction  dbTrans = nullptr 
)
private

Definition at line 2128 of file Map.cpp.

2129{
2130 // Delete from all relevant containers to ensure consistency
2131 ASSERT(info);
2132
2133 // spawnid store
2134 auto spawnMap = GetRespawnMapForType(info->type);
2135 if (!spawnMap)
2136 return;
2137
2138 auto range = spawnMap->equal_range(info->spawnId);
2139 auto it = std::find_if(range.first, range.second, [info](RespawnInfoMap::value_type const& pair) { return (pair.second == info); });
2140 ASSERT(it != range.second, "Respawn stores inconsistent for map %u, spawnid " UI64FMTD " (type %u)", GetId(), info->spawnId, uint32(info->type));
2141 spawnMap->erase(it);
2142
2143 // respawn heap
2144 _respawnTimes->erase(static_cast<RespawnInfoWithHandle*>(info)->handle);
2145
2146 // database
2147 DeleteRespawnInfoFromDB(info->type, info->spawnId, dbTrans);
2148
2149 // then cleanup the object
2150 delete info;
2151}
void DeleteRespawnInfoFromDB(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans=nullptr)
Definition: Map.cpp:2153
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteRespawnInfoFromDB()

void Map::DeleteRespawnInfoFromDB ( SpawnObjectType  type,
ObjectGuid::LowType  spawnId,
CharacterDatabaseTransaction  dbTrans = nullptr 
)
private

Definition at line 2153 of file Map.cpp.

2154{
2155 if (Instanceable())
2156 return;
2157
2159 stmt->setUInt16(0, type);
2160 stmt->setUInt64(1, spawnId);
2161 stmt->setUInt16(2, GetId());
2162 stmt->setUInt32(3, GetInstanceId());
2163 CharacterDatabase.ExecuteOrAppend(dbTrans, stmt);
2164}
@ CHAR_DEL_RESPAWN
void setUInt16(const uint8 index, const uint16 value)
void setUInt64(const uint8 index, const uint64 value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteRespawnTimes()

void Map::DeleteRespawnTimes ( )
inline

Definition at line 470 of file Map.h.

void DeleteRespawnTimesInDB()
Definition: Map.cpp:3508
+ Here is the caller graph for this function:

◆ DeleteRespawnTimesInDB()

void Map::DeleteRespawnTimesInDB ( )

Definition at line 3508 of file Map.cpp.

3509{
3510 if (Instanceable())
3511 return;
3512
3514 stmt->setUInt16(0, GetId());
3515 stmt->setUInt32(1, GetInstanceId());
3516 CharacterDatabase.Execute(stmt);
3517}
@ CHAR_DEL_ALL_RESPAWNS
+ Here is the call graph for this function:

◆ DeleteStateMachine()

void Map::DeleteStateMachine ( )
static

Definition at line 136 of file Map.cpp.

137{
142}
@ GRID_STATE_REMOVAL
Definition: NGrid.h:58
@ GRID_STATE_INVALID
Definition: NGrid.h:55
@ GRID_STATE_IDLE
Definition: NGrid.h:57
@ GRID_STATE_ACTIVE
Definition: NGrid.h:56
+ Here is the caller graph for this function:

◆ DespawnAll()

size_t Map::DespawnAll ( SpawnObjectType  type,
ObjectGuid::LowType  spawnId 
)

Definition at line 2035 of file Map.cpp.

2036{
2037 std::vector<WorldObject*> toUnload;
2038 switch (type)
2039 {
2041 for (auto const& pair : Trinity::Containers::MapEqualRange(GetCreatureBySpawnIdStore(), spawnId))
2042 toUnload.push_back(pair.second);
2043 break;
2045 for (auto const& pair : Trinity::Containers::MapEqualRange(GetGameObjectBySpawnIdStore(), spawnId))
2046 toUnload.push_back(pair.second);
2047 break;
2048 default:
2049 break;
2050 }
2051
2052 for (WorldObject* o : toUnload)
2054
2055 return toUnload.size();
2056}
void AddObjectToRemoveList(WorldObject *obj)
Definition: Map.cpp:2532
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:406
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition: Map.h:402
auto MapEqualRange(M &map, typename M::key_type const &key)
Definition: IteratorPair.h:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoOnPlayers()

template<typename T >
void Map::DoOnPlayers ( T &&  fn)
inline

Definition at line 347 of file Map.h.

348 {
349 for (MapReference const& ref : GetPlayers())
350 if (Player* player = ref.GetSource())
351 fn(player);
352 }
+ Here is the caller graph for this function:

◆ DoRespawn()

void Map::DoRespawn ( SpawnObjectType  type,
ObjectGuid::LowType  spawnId,
uint32  gridId 
)
private

Definition at line 2166 of file Map.cpp.

2167{
2168 if (!IsGridLoaded(gridId)) // if grid isn't loaded, this will be processed in grid load handler
2169 return;
2170
2171 switch (type)
2172 {
2174 {
2175 Creature* obj = new Creature();
2176 if (!obj->LoadFromDB(spawnId, this, true, true))
2177 delete obj;
2178 break;
2179 }
2181 {
2182 GameObject* obj = new GameObject();
2183 if (!obj->LoadFromDB(spawnId, this, true))
2184 delete obj;
2185 break;
2186 }
2187 default:
2188 ABORT_MSG("Invalid spawn type %u (spawnid " UI64FMTD ") on map %u", uint32(type), spawnId, GetId());
2189 }
2190}
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool allowDuplicate)
Definition: Creature.cpp:1790
bool LoadFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool=true)
bool IsGridLoaded(uint32 gridId) const
Definition: Map.h:237
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DynamicObjectCellRelocation()

bool Map::DynamicObjectCellRelocation ( DynamicObject go,
Cell  new_cell 
)
private

Definition at line 1495 of file Map.cpp.

1496{
1497 return MapObjectCellRelocation(go, new_cell, "DynamicObject");
1498}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DynamicObjectRelocation()

void Map::DynamicObjectRelocation ( DynamicObject go,
float  x,
float  y,
float  z,
float  orientation 
)

Definition at line 1104 of file Map.cpp.

1105{
1106 ASSERT(CheckGridIntegrity(dynObj, false, "DynamicObject"));
1107 Cell new_cell(x, y);
1108
1109 if (!getNGrid(new_cell.GridX(), new_cell.GridY()))
1110 return;
1111
1112 Cell old_cell = dynObj->GetCurrentCell();
1113
1114 // delay creature move for grid/cell to grid/cell moves
1115 if (old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell))
1116 {
1117#ifdef TRINITY_DEBUG
1118 TC_LOG_DEBUG("maps", "GameObject {} added to moving list from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", dynObj->GetGUID().ToString(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
1119#endif
1120 AddDynamicObjectToMoveList(dynObj, x, y, z, orientation);
1121 // in diffcell/diffgrid case notifiers called at finishing move dynObj in Map::MoveAllGameObjectsInMoveList
1122 }
1123 else
1124 {
1125 dynObj->Relocate(x, y, z, orientation);
1126 dynObj->UpdatePositionData();
1127 dynObj->UpdateObjectVisibility(false);
1129 }
1130
1131 ASSERT(CheckGridIntegrity(dynObj, true, "DynamicObject"));
1132}
void RemoveDynamicObjectFromMoveList(DynamicObject *go)
Definition: Map.cpp:1212
void AddDynamicObjectToMoveList(DynamicObject *go, float x, float y, float z, float ang)
Definition: Map.cpp:1202
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnsureGridCreated()

void Map::EnsureGridCreated ( GridCoord const &  p)
private

Definition at line 329 of file Map.cpp.

330{
331 if (!getNGrid(p.x_coord, p.y_coord))
332 {
333 TC_LOG_DEBUG("maps", "Creating grid[{}, {}] for map {} instance {}", p.x_coord, p.y_coord, GetId(), i_InstanceId);
334
335 NGridType* ngrid = new NGridType(p.x_coord * MAX_NUMBER_OF_GRIDS + p.y_coord, p.x_coord, p.y_coord, i_gridExpiry, sWorld->getBoolConfig(CONFIG_GRID_UNLOAD));
336 setNGrid(ngrid, p.x_coord, p.y_coord);
337
338 // build a linkage between this map and NGridType
339 buildNGridLinkage(ngrid);
340
342
343 //z coord
344 int gx = (MAX_NUMBER_OF_GRIDS - 1) - p.x_coord;
345 int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
346
347 m_terrain->LoadMapAndVMap(gx, gy);
348 }
349}
NGrid< MAX_NUMBER_OF_CELLS, Player, AllWorldObjectTypes, AllGridObjectTypes > NGridType
Definition: GridDefines.h:99
void buildNGridLinkage(NGridType *pNGridType)
Definition: Map.h:567
void SetGridState(grid_state_t s)
Definition: NGrid.h:92
@ CONFIG_GRID_UNLOAD
Definition: World.h:106
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnsureGridLoaded()

bool Map::EnsureGridLoaded ( Cell const &  cell)
private

Definition at line 371 of file Map.cpp.

372{
373 EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
374 NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
375
376 ASSERT(grid != nullptr);
377 if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
378 {
379 TC_LOG_DEBUG("maps", "Loading grid[{}, {}] for map {} instance {}", cell.GridX(), cell.GridY(), GetId(), i_InstanceId);
380
381 setGridObjectDataLoaded(true, cell.GridX(), cell.GridY());
382
383 LoadGridObjects(grid, cell);
384
385 Balance();
386 return true;
387 }
388
389 return false;
390}
void Balance()
Definition: Map.h:438
virtual void LoadGridObjects(NGridType *grid, Cell const &cell)
Definition: Map.cpp:392
void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y)
Definition: Map.h:576
bool isGridObjectDataLoaded(uint32 x, uint32 y) const
Definition: Map.h:575
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnsureGridLoadedForActiveObject()

void Map::EnsureGridLoadedForActiveObject ( Cell const &  cell,
WorldObject const *  object 
)
private

Definition at line 352 of file Map.cpp.

353{
354 EnsureGridLoaded(cell);
355 NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
356 ASSERT(grid != nullptr);
357
358 if (object->IsPlayer())
359 GetMultiPersonalPhaseTracker().LoadGrid(object->GetPhaseShift(), *grid, this, cell);
360
361 // refresh grid state & timer
362 if (grid->GetGridState() != GRID_STATE_ACTIVE)
363 {
364 TC_LOG_DEBUG("maps", "Active object {} triggers loading of grid [{}, {}] on map {}", object->GetGUID().ToString(), cell.GridX(), cell.GridY(), GetId());
365 ResetGridExpiry(*grid, 0.1f);
367 }
368}
void ResetGridExpiry(NGridType &grid, float factor=1) const
Definition: Map.h:251
MultiPersonalPhaseTracker & GetMultiPersonalPhaseTracker()
Definition: Map.h:787
bool EnsureGridLoaded(Cell const &)
Definition: Map.cpp:371
void LoadGrid(PhaseShift const &phaseShift, NGridType &grid, Map *map, Cell const &cell)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GameObjectCellRelocation()

bool Map::GameObjectCellRelocation ( GameObject go,
Cell  new_cell 
)
private

Definition at line 1490 of file Map.cpp.

1491{
1492 return MapObjectCellRelocation(go, new_cell, "GameObject");
1493}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GameObjectRelocation()

void Map::GameObjectRelocation ( GameObject go,
float  x,
float  y,
float  z,
float  orientation,
bool  respawnRelocationOnFail = true 
)

Definition at line 1075 of file Map.cpp.

1076{
1077 ASSERT(CheckGridIntegrity(go, false, "GameObject"));
1078 Cell new_cell(x, y);
1079
1080 if (!respawnRelocationOnFail && !getNGrid(new_cell.GridX(), new_cell.GridY()))
1081 return;
1082
1083 Cell old_cell = go->GetCurrentCell();
1084
1085 // delay creature move for grid/cell to grid/cell moves
1086 if (old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell))
1087 {
1088#ifdef TRINITY_DEBUG
1089 TC_LOG_DEBUG("maps", "GameObject {} added to moving list from grid[{}, {}]cell[{}, {}] to grid[{}, {}]cell[{}, {}].", go->GetGUID().ToString(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
1090#endif
1091 AddGameObjectToMoveList(go, x, y, z, orientation);
1092 // in diffcell/diffgrid case notifiers called at finishing move go in Map::MoveAllGameObjectsInMoveList
1093 }
1094 else
1095 {
1096 go->Relocate(x, y, z, orientation);
1097 go->AfterRelocation();
1099 }
1100
1101 ASSERT(CheckGridIntegrity(go, true, "GameObject"));
1102}
void AfterRelocation()
void AddGameObjectToMoveList(GameObject *go, float x, float y, float z, float ang)
Definition: Map.cpp:1183
void RemoveGameObjectFromMoveList(GameObject *go)
Definition: Map.cpp:1193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GameObjectRespawnRelocation()

bool Map::GameObjectRespawnRelocation ( GameObject go,
bool  diffGridOnly 
)

Definition at line 1536 of file Map.cpp.

1537{
1538 float resp_x, resp_y, resp_z, resp_o;
1539 go->GetRespawnPosition(resp_x, resp_y, resp_z, &resp_o);
1540 Cell resp_cell(resp_x, resp_y);
1541
1542 //GameObject will be unloaded with grid
1543 if (diffGridOnly && !go->GetCurrentCell().DiffGrid(resp_cell))
1544 return true;
1545
1546#ifdef TRINITY_DEBUG
1547 TC_LOG_DEBUG("maps", "GameObject {} moved from grid[{}, {}]cell[{}, {}] to respawn grid[{}, {}]cell[{}, {}].", go->GetGUID().ToString(), go->GetCurrentCell().GridX(), go->GetCurrentCell().GridY(), go->GetCurrentCell().CellX(), go->GetCurrentCell().CellY(), resp_cell.GridX(), resp_cell.GridY(), resp_cell.CellX(), resp_cell.CellY());
1548#endif
1549
1550 // teleport it to respawn point (like normal respawn if player see)
1551 if (GameObjectCellRelocation(go, resp_cell))
1552 {
1553 go->Relocate(resp_x, resp_y, resp_z, resp_o);
1554 go->UpdatePositionData();
1555 go->UpdateObjectVisibility(false);
1556 return true;
1557 }
1558
1559 return false;
1560}
void GetRespawnPosition(float &x, float &y, float &z, float *ori=nullptr) const
bool GameObjectCellRelocation(GameObject *go, Cell new_cell)
Definition: Map.cpp:1490
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GenerateLowGuid()

template<HighGuid high>
ObjectGuid::LowType Map::GenerateLowGuid ( )
inline

Definition at line 496 of file Map.h.

497 {
498 static_assert(ObjectGuidTraits<high>::SequenceSource.HasFlag(ObjectGuidSequenceSource::Map), "Only map specific guid can be generated in Map context");
499 return GetGuidSequenceGenerator(high).Generate();
500 }
ObjectGuid::LowType Generate()
Definition: ObjectGuid.cpp:788
+ Here is the caller graph for this function:

◆ GetActiveNonPlayersCount()

size_t Map::GetActiveNonPlayersCount ( ) const
inline

Definition at line 519 of file Map.h.

520 {
521 return m_activeNonPlayers.size();
522 }
+ Here is the caller graph for this function:

◆ GetAreaId() [1/2]

uint32 Map::GetAreaId ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z 
)

Definition at line 1700 of file Map.cpp.

1701{
1702 return m_terrain->GetAreaId(phaseShift, GetId(), x, y, z, &_dynamicTree);
1703}
+ Here is the call graph for this function:

◆ GetAreaId() [2/2]

uint32 Map::GetAreaId ( PhaseShift const &  phaseShift,
Position const &  pos 
)
inline

Definition at line 268 of file Map.h.

268{ return GetAreaId(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
uint32 GetAreaId(PhaseShift const &phaseShift, float x, float y, float z)
Definition: Map.cpp:1700
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAreaInfo()

bool Map::GetAreaInfo ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z,
uint32 mogpflags,
int32 adtId,
int32 rootId,
int32 groupId 
)

Definition at line 1695 of file Map.cpp.

1696{
1697 return m_terrain->GetAreaInfo(phaseShift, GetId(), x, y, z, mogpflags, adtId, rootId, groupId, &_dynamicTree);
1698}
+ Here is the call graph for this function:

◆ GetAreaTrigger()

AreaTrigger * Map::GetAreaTrigger ( ObjectGuid const &  guid)

Definition at line 3331 of file Map.cpp.

3332{
3333 return _objectsStore.Find<AreaTrigger>(guid);
3334}
MapStoredObjectTypesContainer _objectsStore
Definition: Map.h:771
SPECIFIC_TYPE * Find(KEY_TYPE const &handle)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAreaTriggerBySpawnId()

AreaTrigger * Map::GetAreaTriggerBySpawnId ( ObjectGuid::LowType  spawnId) const

Definition at line 3413 of file Map.cpp.

3414{
3415 auto const bounds = GetAreaTriggerBySpawnIdStore().equal_range(spawnId);
3416 if (bounds.first == bounds.second)
3417 return nullptr;
3418
3419 return bounds.first->second;
3420}
AreaTriggerBySpawnIdContainer & GetAreaTriggerBySpawnIdStore()
Definition: Map.h:410
+ Here is the call graph for this function:

◆ GetAreaTriggerBySpawnIdStore() [1/2]

AreaTriggerBySpawnIdContainer & Map::GetAreaTriggerBySpawnIdStore ( )
inline

Definition at line 410 of file Map.h.

AreaTriggerBySpawnIdContainer _areaTriggerBySpawnIdStore
Definition: Map.h:774
+ Here is the caller graph for this function:

◆ GetAreaTriggerBySpawnIdStore() [2/2]

AreaTriggerBySpawnIdContainer const & Map::GetAreaTriggerBySpawnIdStore ( ) const
inline

Definition at line 411 of file Map.h.

◆ GetConversation()

Conversation * Map::GetConversation ( ObjectGuid const &  guid)

Definition at line 3341 of file Map.cpp.

3342{
3343 return _objectsStore.Find<Conversation>(guid);
3344}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCorpse()

Corpse * Map::GetCorpse ( ObjectGuid const &  guid)

Definition at line 3351 of file Map.cpp.

3352{
3353 return _objectsStore.Find<Corpse>(guid);
3354}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCorpseByPlayer()

Corpse * Map::GetCorpseByPlayer ( ObjectGuid const &  ownerGuid) const
inline

Definition at line 422 of file Map.h.

423 {
424 auto itr = _corpsesByPlayer.find(ownerGuid);
425 if (itr != _corpsesByPlayer.end())
426 return itr->second;
427
428 return nullptr;
429 }
+ Here is the caller graph for this function:

◆ GetCorpsesInCell()

std::unordered_set< Corpse * > const * Map::GetCorpsesInCell ( uint32  cellId) const
inline

Definition at line 413 of file Map.h.

414 {
415 auto itr = _corpsesByCell.find(cellId);
416 if (itr != _corpsesByCell.end())
417 return &itr->second;
418
419 return nullptr;
420 }
+ Here is the caller graph for this function:

◆ GetCreature()

Creature * Map::GetCreature ( ObjectGuid const &  guid)

Definition at line 3356 of file Map.cpp.

3357{
3358 return _objectsStore.Find<Creature>(guid);
3359}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCreatureBySpawnId()

Creature * Map::GetCreatureBySpawnId ( ObjectGuid::LowType  spawnId) const

Definition at line 3385 of file Map.cpp.

3386{
3387 auto const bounds = GetCreatureBySpawnIdStore().equal_range(spawnId);
3388 if (bounds.first == bounds.second)
3389 return nullptr;
3390
3391 std::unordered_multimap<ObjectGuid::LowType, Creature*>::const_iterator creatureItr = std::find_if(bounds.first, bounds.second, [](Map::CreatureBySpawnIdContainer::value_type const& pair)
3392 {
3393 return pair.second->IsAlive();
3394 });
3395
3396 return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
3397}
+ Here is the call graph for this function:

◆ GetCreatureBySpawnIdStore() [1/2]

CreatureBySpawnIdContainer & Map::GetCreatureBySpawnIdStore ( )
inline

Definition at line 402 of file Map.h.

402{ return _creatureBySpawnIdStore; }
+ Here is the caller graph for this function:

◆ GetCreatureBySpawnIdStore() [2/2]

CreatureBySpawnIdContainer const & Map::GetCreatureBySpawnIdStore ( ) const
inline

Definition at line 403 of file Map.h.

403{ return _creatureBySpawnIdStore; }

◆ GetCreatureRespawnTime()

time_t Map::GetCreatureRespawnTime ( ObjectGuid::LowType  spawnId) const
inline

Definition at line 462 of file Map.h.

462{ return GetRespawnTime(SPAWN_TYPE_CREATURE, spawnId); }
time_t GetRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId) const
Definition: Map.h:453
+ Here is the caller graph for this function:

◆ GetDebugInfo()

std::string Map::GetDebugInfo ( ) const
virtual

Reimplemented in InstanceMap.

Definition at line 3908 of file Map.cpp.

3909{
3910 std::stringstream sstr;
3911 sstr << std::boolalpha
3912 << "Id: " << GetId() << " InstanceId: " << GetInstanceId() << " Difficulty: " << std::to_string(GetDifficultyID())
3913 << " HasPlayers: " << HavePlayers();
3914 return sstr.str();
3915}
bool HavePlayers() const
Definition: Map.h:334
Difficulty GetDifficultyID() const
Definition: Map.h:309
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDifficultyID()

Difficulty Map::GetDifficultyID ( ) const
inline

Definition at line 309 of file Map.h.

309{ return Difficulty(i_spawnMode); }
Difficulty
Definition: DBCEnums.h:817
+ Here is the caller graph for this function:

◆ GetDynamicObject()

DynamicObject * Map::GetDynamicObject ( ObjectGuid const &  guid)

Definition at line 3361 of file Map.cpp.

3362{
3363 return _objectsStore.Find<DynamicObject>(guid);
3364}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEntrancePos()

bool Map::GetEntrancePos ( int32 mapid,
float &  x,
float &  y 
)

Definition at line 3237 of file Map.cpp.

3238{
3239 if (!i_mapEntry)
3240 return false;
3241 return i_mapEntry->GetEntrancePos(mapid, x, y);
3242}
bool GetEntrancePos(int32 &mapid, float &x, float &y) const
+ Here is the call graph for this function:

◆ GetEntry()

MapEntry const * Map::GetEntry ( ) const
inline

Definition at line 193 of file Map.h.

193{ return i_mapEntry; }
+ Here is the caller graph for this function:

◆ GetFullTerrainStatusForPosition()

void Map::GetFullTerrainStatusForPosition ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z,
PositionFullTerrainStatus data,
map_liquidHeaderTypeFlags  reqLiquidType = map_liquidHeaderTypeFlags::AllLiquids,
float  collisionHeight = 2.03128f 
)

Definition at line 1683 of file Map.cpp.

1685{
1686 m_terrain->GetFullTerrainStatusForPosition(phaseShift, GetId(), x, y, z, data, reqLiquidType, collisionHeight, &_dynamicTree);
1687}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGameObject()

GameObject * Map::GetGameObject ( ObjectGuid const &  guid)

Definition at line 3366 of file Map.cpp.

3367{
3368 return _objectsStore.Find<GameObject>(guid);
3369}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGameObjectBySpawnId()

GameObject * Map::GetGameObjectBySpawnId ( ObjectGuid::LowType  spawnId) const

Definition at line 3399 of file Map.cpp.

3400{
3401 auto const bounds = GetGameObjectBySpawnIdStore().equal_range(spawnId);
3402 if (bounds.first == bounds.second)
3403 return nullptr;
3404
3405 std::unordered_multimap<ObjectGuid::LowType, GameObject*>::const_iterator creatureItr = std::find_if(bounds.first, bounds.second, [](Map::GameObjectBySpawnIdContainer::value_type const& pair)
3406 {
3407 return pair.second->isSpawned();
3408 });
3409
3410 return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
3411}
+ Here is the call graph for this function:

◆ GetGameObjectBySpawnIdStore() [1/2]

GameObjectBySpawnIdContainer & Map::GetGameObjectBySpawnIdStore ( )
inline

Definition at line 406 of file Map.h.

+ Here is the caller graph for this function:

◆ GetGameObjectBySpawnIdStore() [2/2]

GameObjectBySpawnIdContainer const & Map::GetGameObjectBySpawnIdStore ( ) const
inline

Definition at line 407 of file Map.h.

◆ GetGameObjectFloor()

float Map::GetGameObjectFloor ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
) const
inline

Definition at line 442 of file Map.h.

443 {
444 return _dynamicTree.getHeight(x, y, z, maxSearchDist, phaseShift);
445 }
float getHeight(float x, float y, float z, float maxSearchDist, PhaseShift const &phaseShift) const

◆ GetGORespawnTime()

time_t Map::GetGORespawnTime ( ObjectGuid::LowType  spawnId) const
inline

Definition at line 463 of file Map.h.

463{ return GetRespawnTime(SPAWN_TYPE_GAMEOBJECT, spawnId); }
+ Here is the caller graph for this function:

◆ GetGridExpiry()

time_t Map::GetGridExpiry ( ) const
inline

Definition at line 256 of file Map.h.

256{ return i_gridExpiry; }

◆ GetGridHeight()

float Map::GetGridHeight ( PhaseShift const &  phaseShift,
float  x,
float  y 
)

Definition at line 1720 of file Map.cpp.

1721{
1722 return m_terrain->GetGridHeight(phaseShift, GetId(), x, y);
1723}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGuidSequenceGenerator()

ObjectGuidGenerator & Map::GetGuidSequenceGenerator ( HighGuid  high)
private

Definition at line 2490 of file Map.cpp.

2491{
2492 auto itr = _guidGenerators.find(high);
2493 if (itr == _guidGenerators.end())
2494 itr = _guidGenerators.insert(std::make_pair(high, std::make_unique<ObjectGuidGenerator>(high))).first;
2495
2496 return *itr->second;
2497}
std::map< HighGuid, std::unique_ptr< ObjectGuidGenerator > > _guidGenerators
Definition: Map.h:769
+ Here is the caller graph for this function:

◆ GetHeight() [1/2]

float Map::GetHeight ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z,
bool  vmap = true,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
)
inline

Definition at line 278 of file Map.h.

278{ return std::max<float>(GetStaticHeight(phaseShift, x, y, z, vmap, maxSearchDist), GetGameObjectFloor(phaseShift, x, y, z, maxSearchDist)); }
float GetStaticHeight(PhaseShift const &phaseShift, float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
Definition: Map.cpp:1725
float GetGameObjectFloor(PhaseShift const &phaseShift, float x, float y, float z, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.h:442
+ Here is the caller graph for this function:

◆ GetHeight() [2/2]

float Map::GetHeight ( PhaseShift const &  phaseShift,
Position const &  pos,
bool  vmap = true,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
)
inline

Definition at line 279 of file Map.h.

279{ return GetHeight(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), vmap, maxSearchDist); }
float GetHeight(PhaseShift const &phaseShift, float x, float y, float z, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
Definition: Map.h:278
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetId()

uint32 Map::GetId ( ) const

Definition at line 3175 of file Map.cpp.

3176{
3177 return i_mapEntry->ID;
3178}
uint32 ID
+ Here is the caller graph for this function:

◆ GetInstanceId()

uint32 Map::GetInstanceId ( ) const
inline

Definition at line 302 of file Map.h.

302{ return i_InstanceId; }
+ Here is the caller graph for this function:

◆ GetLinkedRespawnTime()

time_t Map::GetLinkedRespawnTime ( ObjectGuid  guid) const

Definition at line 3519 of file Map.cpp.

3520{
3521 ObjectGuid linkedGuid = sObjectMgr->GetLinkedRespawnGuid(guid);
3522 switch (linkedGuid.GetHigh())
3523 {
3524 case HighGuid::Creature:
3525 return GetCreatureRespawnTime(linkedGuid.GetCounter());
3526 case HighGuid::GameObject:
3527 return GetGORespawnTime(linkedGuid.GetCounter());
3528 default:
3529 break;
3530 }
3531
3532 return time_t(0);
3533}
time_t GetGORespawnTime(ObjectGuid::LowType spawnId) const
Definition: Map.h:463
time_t GetCreatureRespawnTime(ObjectGuid::LowType spawnId) const
Definition: Map.h:462
HighGuid GetHigh() const
Definition: ObjectGuid.h:286
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLiquidStatus()

ZLiquidStatus Map::GetLiquidStatus ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z,
map_liquidHeaderTypeFlags  ReqLiquidType,
LiquidData data = nullptr,
float  collisionHeight = 2.03128f 
)

Definition at line 1689 of file Map.cpp.

1691{
1692 return m_terrain->GetLiquidStatus(phaseShift, GetId(), x, y, z, ReqLiquidType, data, collisionHeight);
1693}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMapDifficulty()

MapDifficultyEntry const * Map::GetMapDifficulty ( ) const

Definition at line 3170 of file Map.cpp.

3171{
3172 return sDB2Manager.GetMapDifficultyData(GetId(), GetDifficultyID());
3173}
#define sDB2Manager
Definition: DB2Stores.h:522
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMapName()

char const * Map::GetMapName ( ) const

Definition at line 1822 of file Map.cpp.

1823{
1824 return i_mapEntry->MapName[sWorld->GetDefaultDbcLocale()];
1825}
LocalizedString MapName
+ Here is the caller graph for this function:

◆ GetMaxLowGuid()

template<HighGuid high>
ObjectGuid::LowType Map::GetMaxLowGuid ( )
inline

Definition at line 503 of file Map.h.

504 {
505 static_assert(ObjectGuidTraits<high>::SequenceSource.HasFlag(ObjectGuidSequenceSource::Map), "Only map specific guid can be retrieved in Map context");
507 }
ObjectGuid::LowType GetNextAfterMaxUsed() const
Definition: ObjectGuid.h:404
+ Here is the caller graph for this function:

◆ GetMinHeight()

float Map::GetMinHeight ( PhaseShift const &  phaseShift,
float  x,
float  y 
)

Definition at line 1715 of file Map.cpp.

1716{
1717 return m_terrain->GetMinHeight(phaseShift, GetId(), x, y);
1718}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMultiPersonalPhaseTracker()

MultiPersonalPhaseTracker & Map::GetMultiPersonalPhaseTracker ( )
inline

Definition at line 787 of file Map.h.

MultiPersonalPhaseTracker _multiPersonalPhaseTracker
Definition: Map.h:791
+ Here is the caller graph for this function:

◆ getNGrid()

NGridType * Map::getNGrid ( uint32  x,
uint32  y 
) const
inlineprivate

Definition at line 569 of file Map.h.

570 {
571 ASSERT(x < MAX_NUMBER_OF_GRIDS && y < MAX_NUMBER_OF_GRIDS, "x = %u, y = %u", x, y);
572 return i_grids[x][y];
573 }
NGridType * i_grids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
Definition: Map.h:622
+ Here is the caller graph for this function:

◆ getObjectHitPos()

bool Map::getObjectHitPos ( PhaseShift const &  phaseShift,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float &  rx,
float &  ry,
float &  rz,
float  modifyDist 
)

Definition at line 1761 of file Map.cpp.

1762{
1763 G3D::Vector3 startPos(x1, y1, z1);
1764 G3D::Vector3 dstPos(x2, y2, z2);
1765
1766 G3D::Vector3 resultPos;
1767 bool result = _dynamicTree.getObjectHitPos(startPos, dstPos, resultPos, modifyDist, phaseShift);
1768
1769 rx = resultPos.x;
1770 ry = resultPos.y;
1771 rz = resultPos.z;
1772 return result;
1773}
bool getObjectHitPos(G3D::Vector3 const &startPos, G3D::Vector3 const &endPos, G3D::Vector3 &resultHitPos, float modifyDist, PhaseShift const &phaseShift) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetObjectsStore()

MapStoredObjectTypesContainer & Map::GetObjectsStore ( )
inline

Definition at line 399 of file Map.h.

399{ return _objectsStore; }
+ Here is the caller graph for this function:

◆ GetOrGenerateZoneDefaultWeather()

Weather * Map::GetOrGenerateZoneDefaultWeather ( uint32  zoneId)

Definition at line 3807 of file Map.cpp.

3808{
3809 WeatherData const* weatherData = WeatherMgr::GetWeatherData(zoneId);
3810 if (!weatherData)
3811 return nullptr;
3812
3813 ZoneDynamicInfo& info = _zoneDynamicInfo[zoneId];
3814 if (!info.DefaultWeather)
3815 {
3816 info.DefaultWeather = std::make_unique<Weather>(zoneId, weatherData);
3817 info.DefaultWeather->ReGenerate();
3818 info.DefaultWeather->UpdateWeather();
3819 }
3820
3821 return info.DefaultWeather.get();
3822}
ZoneDynamicInfoMap _zoneDynamicInfo
Definition: Map.h:764
WeatherData const * GetWeatherData(uint32 zone_id)
Definition: WeatherMgr.cpp:38
std::unique_ptr< Weather > DefaultWeather
Definition: Map.h:137
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOwnerGuildId()

virtual ObjectGuid::LowType Map::GetOwnerGuildId ( uint32  = TEAM_OTHER) const
inlinevirtual

Definition at line 448 of file Map.h.

448{ return UI64LIT(0); }
#define UI64LIT(N)
Definition: Define.h:128
+ Here is the caller graph for this function:

◆ GetPet()

Pet * Map::GetPet ( ObjectGuid const &  guid)

Definition at line 3371 of file Map.cpp.

3372{
3373 return _objectsStore.Find<Pet>(guid);
3374}
Definition: Pet.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPlayer()

Player * Map::GetPlayer ( ObjectGuid const &  guid)

Definition at line 3346 of file Map.cpp.

3347{
3348 return ObjectAccessor::GetPlayer(this, guid);
3349}
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPlayers()

PlayerList const & Map::GetPlayers ( ) const
inline

Definition at line 344 of file Map.h.

344{ return m_mapRefManager; }
+ Here is the caller graph for this function:

◆ GetPlayersCountExceptGMs()

uint32 Map::GetPlayersCountExceptGMs ( ) const

Definition at line 2633 of file Map.cpp.

2634{
2635 uint32 count = 0;
2637 if (!itr->GetSource()->IsGameMaster())
2638 ++count;
2639 return count;
2640}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPoolData() [1/2]

SpawnedPoolData & Map::GetPoolData ( )
inline

Definition at line 689 of file Map.h.

689{ return *_poolData; }
+ Here is the caller graph for this function:

◆ GetPoolData() [2/2]

SpawnedPoolData const & Map::GetPoolData ( ) const
inline

Definition at line 690 of file Map.h.

690{ return *_poolData; }

◆ GetRespawnInfo() [1/2]

RespawnInfo * Map::GetRespawnInfo ( SpawnObjectType  type,
ObjectGuid::LowType  spawnId 
) const
private

Definition at line 2108 of file Map.cpp.

2109{
2110 RespawnInfoMap const* map = GetRespawnMapForType(type);
2111 if (!map)
2112 return nullptr;
2113 auto it = map->find(spawnId);
2114 if (it == map->end())
2115 return nullptr;
2116 return it->second;
2117}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetRespawnInfo() [2/2]

void Map::GetRespawnInfo ( std::vector< RespawnInfo const * > &  respawnData,
SpawnObjectTypeMask  types 
) const

Definition at line 2100 of file Map.cpp.

2101{
2102 if (types & SPAWN_TYPEMASK_CREATURE)
2104 if (types & SPAWN_TYPEMASK_GAMEOBJECT)
2106}
static void PushRespawnInfoFrom(std::vector< RespawnInfo const * > &data, RespawnInfoMap const &map)
Definition: Map.cpp:2093
@ SPAWN_TYPEMASK_CREATURE
Definition: SpawnData.h:43
@ SPAWN_TYPEMASK_GAMEOBJECT
Definition: SpawnData.h:44
RespawnInfoMap _gameObjectRespawnTimesBySpawnId
Definition: Map.h:728
RespawnInfoMap _creatureRespawnTimesBySpawnId
Definition: Map.h:727
+ Here is the call graph for this function:

◆ GetRespawnMapForType() [1/2]

RespawnInfoMap * Map::GetRespawnMapForType ( SpawnObjectType  type)
inlineprivate

Definition at line 729 of file Map.h.

730 {
731 switch (type)
732 {
733 default:
734 ABORT();
740 return nullptr;
741 }
742 }
@ SPAWN_TYPE_AREATRIGGER
Definition: SpawnData.h:36
+ Here is the caller graph for this function:

◆ GetRespawnMapForType() [2/2]

RespawnInfoMap const * Map::GetRespawnMapForType ( SpawnObjectType  type) const
inlineprivate

Definition at line 743 of file Map.h.

744 {
745 switch (type)
746 {
747 default:
748 ABORT();
754 return nullptr;
755 }
756 }

◆ GetRespawnTime()

time_t Map::GetRespawnTime ( SpawnObjectType  type,
ObjectGuid::LowType  spawnId 
) const
inline

Definition at line 453 of file Map.h.

454 {
455 if (auto map = GetRespawnMapForType(type))
456 {
457 auto it = map->find(spawnId);
458 return (it == map->end()) ? 0 : it->second->respawnTime;
459 }
460 return 0;
461 }
+ Here is the caller graph for this function:

◆ GetSceneObject()

SceneObject * Map::GetSceneObject ( ObjectGuid const &  guid)

Definition at line 3336 of file Map.cpp.

3337{
3338 return _objectsStore.Find<SceneObject>(guid);
3339}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpawnGroupData()

SpawnGroupTemplateData const * Map::GetSpawnGroupData ( uint32  groupId) const

Definition at line 2308 of file Map.cpp.

2309{
2310 SpawnGroupTemplateData const* data = sObjectMgr->GetSpawnGroupData(groupId);
2311 if (data && (data->flags & SPAWNGROUP_FLAG_SYSTEM || data->mapId == GetId()))
2312 return data;
2313 return nullptr;
2314}
@ SPAWNGROUP_FLAG_SYSTEM
Definition: SpawnData.h:54
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetStaticHeight() [1/2]

float Map::GetStaticHeight ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z,
bool  checkVMap = true,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
)

Definition at line 1725 of file Map.cpp.

1726{
1727 return m_terrain->GetStaticHeight(phaseShift, GetId(), x, y, z, checkVMap, maxSearchDist);
1728}
+ Here is the call graph for this function:

◆ GetStaticHeight() [2/2]

float Map::GetStaticHeight ( PhaseShift const &  phaseShift,
Position const &  pos,
bool  checkVMap = true,
float  maxSearchDist = DEFAULT_HEIGHT_SEARCH 
)
inline

Definition at line 277 of file Map.h.

277{ return GetStaticHeight(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), checkVMap, maxSearchDist); }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTerrain()

TerrainInfo * Map::GetTerrain ( ) const
inline

Definition at line 261 of file Map.h.

261{ return m_terrain.get(); }
+ Here is the caller graph for this function:

◆ GetTransport()

Transport * Map::GetTransport ( ObjectGuid const &  guid)

Definition at line 3376 of file Map.cpp.

3377{
3378 if (!guid.IsMOTransport())
3379 return nullptr;
3380
3381 GameObject* go = GetGameObject(guid);
3382 return go ? go->ToTransport() : nullptr;
3383}
Transport * ToTransport()
Definition: GameObject.h:378
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3366
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetUnloadLock()

bool Map::GetUnloadLock ( GridCoord const &  p) const
inline

Definition at line 241 of file Map.h.

241{ return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); }
bool getUnloadLock() const
Definition: NGrid.h:105

◆ GetVisibilityRange()

float Map::GetVisibilityRange ( ) const
inline

Definition at line 217 of file Map.h.

217{ return m_VisibleDistance; }
+ Here is the caller graph for this function:

◆ GetWaterLevel()

float Map::GetWaterLevel ( PhaseShift const &  phaseShift,
float  x,
float  y 
)

Definition at line 1730 of file Map.cpp.

1731{
1732 return m_terrain->GetWaterLevel(phaseShift, GetId(), x, y);
1733}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWaterOrGroundLevel()

float Map::GetWaterOrGroundLevel ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z,
float *  ground = nullptr,
bool  swim = false,
float  collisionHeight = 2.03128f 
)

Definition at line 1745 of file Map.cpp.

1746{
1747 return m_terrain->GetWaterOrGroundLevel(phaseShift, GetId(), x, y, z, ground, swim, collisionHeight, &_dynamicTree);
1748}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWorldObjectBySpawnId()

WorldObject * Map::GetWorldObjectBySpawnId ( SpawnObjectType  type,
ObjectGuid::LowType  spawnId 
) const
inline

Definition at line 384 of file Map.h.

385 {
386 switch (type)
387 {
389 return reinterpret_cast<WorldObject*>(GetCreatureBySpawnId(spawnId));
391 return reinterpret_cast<WorldObject*>(GetGameObjectBySpawnId(spawnId));
393 return reinterpret_cast<WorldObject*>(GetAreaTriggerBySpawnId(spawnId));
394 default:
395 return nullptr;
396 }
397 }
Creature * GetCreatureBySpawnId(ObjectGuid::LowType spawnId) const
Definition: Map.cpp:3385
AreaTrigger * GetAreaTriggerBySpawnId(ObjectGuid::LowType spawnId) const
Definition: Map.cpp:3413
GameObject * GetGameObjectBySpawnId(ObjectGuid::LowType spawnId) const
Definition: Map.cpp:3399
+ Here is the caller graph for this function:

◆ GetWorldStateValue()

int32 Map::GetWorldStateValue ( int32  worldStateId) const

Definition at line 476 of file Map.cpp.

477{
478 if (int32 const* value = Trinity::Containers::MapGetValuePtr(_worldStateValues, worldStateId))
479 return *value;
480
481 return 0;
482}
auto MapGetValuePtr(M &map, typename M::key_type const &key)
Definition: MapUtils.h:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWorldStateValues()

WorldStateValueContainer const & Map::GetWorldStateValues ( ) const
inline

Definition at line 799 of file Map.h.

799{ return _worldStateValues; }
+ Here is the caller graph for this function:

◆ GetZoneAndAreaId() [1/2]

void Map::GetZoneAndAreaId ( PhaseShift const &  phaseShift,
uint32 zoneid,
uint32 areaid,
float  x,
float  y,
float  z 
)

Definition at line 1710 of file Map.cpp.

1711{
1712 return m_terrain->GetZoneAndAreaId(phaseShift, GetId(), zoneid, areaid, x, y, z, &_dynamicTree);
1713}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetZoneAndAreaId() [2/2]

void Map::GetZoneAndAreaId ( PhaseShift const &  phaseShift,
uint32 zoneid,
uint32 areaid,
Position const &  pos 
)
inline

Definition at line 272 of file Map.h.

272{ GetZoneAndAreaId(phaseShift, zoneid, areaid, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
void GetZoneAndAreaId(PhaseShift const &phaseShift, uint32 &zoneid, uint32 &areaid, float x, float y, float z)
Definition: Map.cpp:1710
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetZoneId() [1/2]

uint32 Map::GetZoneId ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z 
)

Definition at line 1705 of file Map.cpp.

1706{
1707 return m_terrain->GetZoneId(phaseShift, GetId(), x, y, z, &_dynamicTree);
1708}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetZoneId() [2/2]

uint32 Map::GetZoneId ( PhaseShift const &  phaseShift,
Position const &  pos 
)
inline

Definition at line 270 of file Map.h.

270{ return GetZoneId(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); }
uint32 GetZoneId(PhaseShift const &phaseShift, float x, float y, float z)
Definition: Map.cpp:1705
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetZoneWeather()

WeatherState Map::GetZoneWeather ( uint32  zoneId) const

Definition at line 3824 of file Map.cpp.

3825{
3827 if (zoneDynamicInfo)
3828 {
3829 if (WeatherState weatherId = zoneDynamicInfo->WeatherId)
3830 return weatherId;
3831
3832 if (zoneDynamicInfo->DefaultWeather)
3833 return zoneDynamicInfo->DefaultWeather->GetWeatherState();
3834 }
3835
3836 return WEATHER_STATE_FINE;
3837}
WeatherState
Definition: Weather.h:46
@ WEATHER_STATE_FINE
Definition: Weather.h:47
WeatherState WeatherId
Definition: Map.h:138
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GridMarkNoUnload()

void Map::GridMarkNoUnload ( uint32  x,
uint32  y 
)

Definition at line 398 of file Map.cpp.

399{
400 // First make sure this grid is loaded
401 float gX = ((float(x) - 0.5f - CENTER_GRID_ID) * SIZE_OF_GRIDS) + (CENTER_GRID_OFFSET * 2);
402 float gY = ((float(y) - 0.5f - CENTER_GRID_ID) * SIZE_OF_GRIDS) + (CENTER_GRID_OFFSET * 2);
403 Cell cell = Cell(gX, gY);
404 EnsureGridLoaded(cell);
405
406 // Mark as don't unload
407 NGridType* grid = getNGrid(x, y);
408 grid->setUnloadExplicitLock(true);
409}
#define SIZE_OF_GRIDS
Definition: GridDefines.h:40
#define CENTER_GRID_ID
Definition: GridDefines.h:41
#define CENTER_GRID_OFFSET
Definition: GridDefines.h:43
void setUnloadExplicitLock(bool on)
Definition: NGrid.h:106
+ Here is the call graph for this function:

◆ GridUnmarkNoUnload()

void Map::GridUnmarkNoUnload ( uint32  x,
uint32  y 
)

Definition at line 411 of file Map.cpp.

412{
413 // If grid is loaded, clear unload lock
414 if (IsGridLoaded(GridCoord(x, y)))
415 {
416 NGridType* grid = getNGrid(x, y);
417 grid->setUnloadExplicitLock(false);
418 }
419}
+ Here is the call graph for this function:

◆ HavePlayers()

bool Map::HavePlayers ( ) const
inline

Definition at line 334 of file Map.h.

334{ return !m_mapRefManager.isEmpty(); }
bool isEmpty() const
Definition: LinkedList.h:110
+ Here is the caller graph for this function:

◆ InitializeObject() [1/3]

template<>
void Map::InitializeObject ( Creature obj)

Definition at line 522 of file Map.cpp.

523{
525}

◆ InitializeObject() [2/3]

template<>
void Map::InitializeObject ( GameObject obj)

Definition at line 528 of file Map.cpp.

529{
531}

◆ InitializeObject() [3/3]

template<class T >
void Map::InitializeObject ( T *  obj)
private

Definition at line 519 of file Map.cpp.

519{ }
+ Here is the caller graph for this function:

◆ InitStateMachine()

void Map::InitStateMachine ( )
static

Definition at line 128 of file Map.cpp.

+ Here is the caller graph for this function:

◆ InitVisibilityDistance()

void Map::InitVisibilityDistance ( )
virtual

Reimplemented in GarrisonMap, InstanceMap, and BattlegroundMap.

Definition at line 185 of file Map.cpp.

186{
187 //init visibility for continents
190}
static int32 GetVisibilityNotifyPeriodOnContinents()
Definition: World.h:788
static float GetMaxVisibleDistanceOnContinents()
Definition: World.h:783
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InsertGameObjectModel()

void Map::InsertGameObjectModel ( GameObjectModel const &  model)
inline

Definition at line 440 of file Map.h.

440{ _dynamicTree.insert(model); }
void insert(GameObjectModel const &)
+ Here is the caller graph for this function:

◆ Instanceable()

bool Map::Instanceable ( ) const

Definition at line 3180 of file Map.cpp.

3181{
3182 return i_mapEntry && i_mapEntry->Instanceable();
3183}
bool Instanceable() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Is25ManRaid()

bool Map::Is25ManRaid ( ) const

Definition at line 3207 of file Map.cpp.

3208{
3210}
@ DIFFICULTY_25_HC
Definition: DBCEnums.h:824
@ DIFFICULTY_25_N
Definition: DBCEnums.h:822
bool IsRaid() const
Definition: Map.cpp:3195
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsBattleArena()

bool Map::IsBattleArena ( ) const

Definition at line 3217 of file Map.cpp.

3218{
3219 return i_mapEntry && i_mapEntry->IsBattleArena();
3220}
bool IsBattleArena() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsBattleground()

bool Map::IsBattleground ( ) const

Definition at line 3212 of file Map.cpp.

3213{
3215}
bool IsBattleground() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsBattlegroundOrArena()

bool Map::IsBattlegroundOrArena ( ) const

Definition at line 3222 of file Map.cpp.

3223{
3225}
bool IsBattlegroundOrArena() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCellMarked()

bool Map::isCellMarked ( uint32  pCellId)
inline

Definition at line 331 of file Map.h.

331{ return marked_cells.test(pCellId); }
std::bitset< TOTAL_NUMBER_OF_CELLS_PER_MAP *TOTAL_NUMBER_OF_CELLS_PER_MAP > marked_cells
Definition: Map.h:623
+ Here is the caller graph for this function:

◆ IsDungeon()

bool Map::IsDungeon ( ) const

Definition at line 3185 of file Map.cpp.

3186{
3187 return i_mapEntry && i_mapEntry->IsDungeon();
3188}
bool IsDungeon() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsGarrison()

bool Map::IsGarrison ( ) const

Definition at line 3232 of file Map.cpp.

3233{
3234 return i_mapEntry && i_mapEntry->IsGarrison();
3235}
bool IsGarrison() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsGridLoaded() [1/4]

bool Map::IsGridLoaded ( float  x,
float  y 
) const
inline

Definition at line 238 of file Map.h.

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

◆ IsGridLoaded() [2/4]

bool Map::IsGridLoaded ( GridCoord const &  p) const
private

Definition at line 618 of file Map.cpp.

619{
620 return (getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord));
621}
+ Here is the call graph for this function:

◆ IsGridLoaded() [3/4]

bool Map::IsGridLoaded ( Position const &  pos) const
inline

Definition at line 239 of file Map.h.

239{ return IsGridLoaded(pos.GetPositionX(), pos.GetPositionY()); }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsGridLoaded() [4/4]

bool Map::IsGridLoaded ( uint32  gridId) const
inline

Definition at line 237 of file Map.h.

237{ return IsGridLoaded(GridCoord(gridId % MAX_NUMBER_OF_GRIDS, gridId / MAX_NUMBER_OF_GRIDS)); }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isGridObjectDataLoaded()

bool Map::isGridObjectDataLoaded ( uint32  x,
uint32  y 
) const
inlineprivate

Definition at line 575 of file Map.h.

575{ return getNGrid(x, y)->isGridObjectDataLoaded(); }
+ Here is the caller graph for this function:

◆ IsHeroic()

bool Map::IsHeroic ( ) const

Definition at line 3200 of file Map.cpp.

3201{
3202 if (DifficultyEntry const* difficulty = sDifficultyStore.LookupEntry(i_spawnMode))
3203 return difficulty->Flags & DIFFICULTY_FLAG_HEROIC;
3204 return false;
3205}
DB2Storage< DifficultyEntry > sDifficultyStore("Difficulty.db2", &DifficultyLoadInfo::Instance)
@ DIFFICULTY_FLAG_HEROIC
Definition: DBCEnums.h:860
+ Here is the caller graph for this function:

◆ isInLineOfSight()

bool Map::isInLineOfSight ( PhaseShift const &  phaseShift,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
LineOfSightChecks  checks,
VMAP::ModelIgnoreFlags  ignoreFlags 
) const

Definition at line 1750 of file Map.cpp.

1751{
1752 if ((checks & LINEOFSIGHT_CHECK_VMAP)
1753 && !VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(PhasingHandler::GetTerrainMapId(phaseShift, GetId(), m_terrain.get(), x1, y1), x1, y1, z1, x2, y2, z2, ignoreFlags))
1754 return false;
1755 if (sWorld->getBoolConfig(CONFIG_CHECK_GOBJECT_LOS) && (checks & LINEOFSIGHT_CHECK_GOBJECT)
1756 && !_dynamicTree.isInLineOfSight({ x1, y1, z1 }, { x2, y2, z2 }, phaseShift))
1757 return false;
1758 return true;
1759}
@ LINEOFSIGHT_CHECK_VMAP
@ LINEOFSIGHT_CHECK_GOBJECT
bool isInLineOfSight(G3D::Vector3 const &startPos, G3D::Vector3 const &endPos, PhaseShift const &phaseShift) const
bool isInLineOfSight(PhaseShift const &phaseShift, float x1, float y1, float z1, float x2, float y2, float z2, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
Definition: Map.cpp:1750
static uint32 GetTerrainMapId(PhaseShift const &phaseShift, uint32 mapId, TerrainInfo const *terrain, float x, float y)
static VMapManager2 * createOrGetVMapManager()
Definition: VMapFactory.cpp:27
@ CONFIG_CHECK_GOBJECT_LOS
Definition: World.h:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsInWater()

bool Map::IsInWater ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z,
LiquidData data = nullptr 
)

Definition at line 1735 of file Map.cpp.

1736{
1737 return m_terrain->IsInWater(phaseShift, GetId(), x, y, z, data);
1738}
+ Here is the call graph for this function:

◆ IsNonRaidDungeon()

bool Map::IsNonRaidDungeon ( ) const

Definition at line 3190 of file Map.cpp.

3191{
3193}
bool IsNonRaidDungeon() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsRaid()

bool Map::IsRaid ( ) const

Definition at line 3195 of file Map.cpp.

3196{
3197 return i_mapEntry && i_mapEntry->IsRaid();
3198}
bool IsRaid() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsRemovalGrid() [1/2]

bool Map::IsRemovalGrid ( float  x,
float  y 
) const
inline

Definition at line 230 of file Map.h.

231 {
234 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsRemovalGrid() [2/2]

bool Map::IsRemovalGrid ( Position const &  pos) const
inline

Definition at line 235 of file Map.h.

235{ return IsRemovalGrid(pos.GetPositionX(), pos.GetPositionY()); }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsScenario()

bool Map::IsScenario ( ) const

Definition at line 3227 of file Map.cpp.

3228{
3229 return i_mapEntry && i_mapEntry->IsScenario();
3230}
bool IsScenario() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsSpawnGroupActive()

bool Map::IsSpawnGroupActive ( uint32  groupId) const

Definition at line 2442 of file Map.cpp.

2443{
2444 SpawnGroupTemplateData const* const data = GetSpawnGroupData(groupId);
2445 if (!data)
2446 {
2447 TC_LOG_ERROR("maps", "Tried to query state of non-existing spawn group {} on map {}.", groupId, GetId());
2448 return false;
2449 }
2450 if (data->flags & SPAWNGROUP_FLAG_SYSTEM)
2451 return true;
2452 // either manual spawn group and toggled, or not manual spawn group and not toggled...
2453 return (_toggledSpawnGroupIds.find(groupId) != _toggledSpawnGroupIds.end()) != !(data->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN);
2454}
@ SPAWNGROUP_FLAG_MANUAL_SPAWN
Definition: SpawnData.h:56
std::unordered_set< uint32 > _toggledSpawnGroupIds
Definition: Map.h:759
SpawnGroupTemplateData const * GetSpawnGroupData(uint32 groupId) const
Definition: Map.cpp:2308
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsUnderWater()

bool Map::IsUnderWater ( PhaseShift const &  phaseShift,
float  x,
float  y,
float  z 
)

Definition at line 1740 of file Map.cpp.

1741{
1742 return m_terrain->IsUnderWater(phaseShift, GetId(), x, y, z);
1743}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadAllCells()

void Map::LoadAllCells ( )

Definition at line 121 of file Map.cpp.

122{
123 for (uint32 cellX = 0; cellX < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellX++)
124 for (uint32 cellY = 0; cellY < TOTAL_NUMBER_OF_CELLS_PER_MAP; cellY++)
126}
#define TOTAL_NUMBER_OF_CELLS_PER_MAP
Definition: GridDefines.h:53
#define CENTER_GRID_CELL_ID
Definition: GridDefines.h:50
void LoadGrid(float x, float y)
Definition: Map.cpp:421
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadCorpseData()

void Map::LoadCorpseData ( )

Definition at line 3535 of file Map.cpp.

3536{
3538 stmt->setUInt32(0, GetId());
3539 stmt->setUInt32(1, GetInstanceId());
3540
3541 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
3542 // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, race, class, gender, flags, dynFlags, time, corpseType, instanceId, guid FROM corpse WHERE mapId = ? AND instanceId = ?
3543 PreparedQueryResult result = CharacterDatabase.Query(stmt);
3544 if (!result)
3545 return;
3546
3547 std::unordered_map<ObjectGuid::LowType, std::unordered_set<uint32>> phases;
3548 std::unordered_map<ObjectGuid::LowType, std::vector<UF::ChrCustomizationChoice>> customizations;
3549
3550 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSE_PHASES);
3551 stmt->setUInt32(0, GetId());
3552 stmt->setUInt32(1, GetInstanceId());
3553
3554 // 0 1
3555 // SELECT OwnerGuid, PhaseId FROM corpse_phases cp LEFT JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ? AND c.instanceId = ?
3556 if (PreparedQueryResult phaseResult = CharacterDatabase.Query(stmt))
3557 {
3558 do
3559 {
3560 Field* fields = phaseResult->Fetch();
3561 ObjectGuid::LowType guid = fields[0].GetUInt64();
3562 uint32 phaseId = fields[1].GetUInt32();
3563
3564 phases[guid].insert(phaseId);
3565
3566 } while (phaseResult->NextRow());
3567 }
3568
3569 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSE_CUSTOMIZATIONS);
3570 stmt->setUInt32(0, GetId());
3571 stmt->setUInt32(1, GetInstanceId());
3572
3573 // 0 1 2
3574 // SELECT cc.ownerGuid, cc.chrCustomizationOptionID, cc.chrCustomizationChoiceID FROM corpse_customizations cc LEFT JOIN corpse c ON cc.ownerGuid = c.guid WHERE c.mapId = ? AND c.instanceId = ?
3575 if (PreparedQueryResult customizationResult = CharacterDatabase.Query(stmt))
3576 {
3577 do
3578 {
3579 Field* fields = customizationResult->Fetch();
3580 ObjectGuid::LowType guid = fields[0].GetUInt64();
3581 std::vector<UF::ChrCustomizationChoice>& customizationsForCorpse = customizations[guid];
3582
3583 customizationsForCorpse.emplace_back();
3584 UF::ChrCustomizationChoice& choice = customizationsForCorpse.back();