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

#include <TerrainMgr.h>

Public Member Functions

 TerrainInfo (uint32 mapId)
 
 TerrainInfo (TerrainInfo const &)=delete
 
 TerrainInfo (TerrainInfo &&)=delete
 
TerrainInfooperator= (TerrainInfo const &)=delete
 
TerrainInfooperator= (TerrainInfo &&)=delete
 
 ~TerrainInfo ()
 
uint32 GetId () const
 
char const * GetMapName () const
 
void DiscoverGridMapFiles ()
 
bool HasChildTerrainGridFile (uint32 mapId, int32 gx, int32 gy) const
 
void AddChildTerrain (std::shared_ptr< TerrainInfo > childTerrain)
 
void LoadMapAndVMap (int32 gx, int32 gy)
 
void LoadMMapInstance (uint32 mapId, uint32 instanceId)
 
void LoadMMap (uint32 instanceId, int32 gx, int32 gy)
 
void UnloadMap (int32 gx, int32 gy)
 
void UnloadMMapInstance (uint32 mapId, uint32 instanceId)
 
void CleanUpGrids (uint32 diff)
 
void GetFullTerrainStatusForPosition (PhaseShift const &phaseShift, uint32 mapId, float x, float y, float z, PositionFullTerrainStatus &data, Optional< map_liquidHeaderTypeFlags > reqLiquidType={}, float collisionHeight=2.03128f, DynamicMapTree const *dynamicMapTree=nullptr)
 
ZLiquidStatus GetLiquidStatus (PhaseShift const &phaseShift, uint32 mapId, float x, float y, float z, Optional< map_liquidHeaderTypeFlags > ReqLiquidType={}, LiquidData *data=nullptr, float collisionHeight=2.03128f)
 
bool GetAreaInfo (PhaseShift const &phaseShift, uint32 mapId, float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId, DynamicMapTree const *dynamicMapTree=nullptr)
 
uint32 GetAreaId (PhaseShift const &phaseShift, uint32 mapId, float x, float y, float z, DynamicMapTree const *dynamicMapTree=nullptr)
 
uint32 GetAreaId (PhaseShift const &phaseShift, uint32 mapId, Position const &pos, DynamicMapTree const *dynamicMapTree=nullptr)
 
uint32 GetZoneId (PhaseShift const &phaseShift, uint32 mapId, float x, float y, float z, DynamicMapTree const *dynamicMapTree=nullptr)
 
uint32 GetZoneId (PhaseShift const &phaseShift, uint32 mapId, Position const &pos, DynamicMapTree const *dynamicMapTree=nullptr)
 
void GetZoneAndAreaId (PhaseShift const &phaseShift, uint32 mapId, uint32 &zoneid, uint32 &areaid, float x, float y, float z, DynamicMapTree const *dynamicMapTree=nullptr)
 
void GetZoneAndAreaId (PhaseShift const &phaseShift, uint32 mapId, uint32 &zoneid, uint32 &areaid, Position const &pos, DynamicMapTree const *dynamicMapTree=nullptr)
 
float GetMinHeight (PhaseShift const &phaseShift, uint32 mapId, float x, float y)
 
float GetGridHeight (PhaseShift const &phaseShift, uint32 mapId, float x, float y)
 
float GetStaticHeight (PhaseShift const &phaseShift, uint32 mapId, float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
 
float GetStaticHeight (PhaseShift const &phaseShift, uint32 mapId, Position const &pos, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
 
float GetWaterLevel (PhaseShift const &phaseShift, uint32 mapId, float x, float y)
 
bool IsInWater (PhaseShift const &phaseShift, uint32 mapId, float x, float y, float z, LiquidData *data=nullptr)
 
bool IsUnderWater (PhaseShift const &phaseShift, uint32 mapId, float x, float y, float z)
 
float GetWaterOrGroundLevel (PhaseShift const &phaseShift, uint32 mapId, float x, float y, float z, float *ground=nullptr, bool swim=false, float collisionHeight=2.03128f, DynamicMapTree const *dynamicMapTree=nullptr)
 

Static Public Member Functions

static bool ExistMap (uint32 mapid, int32 gx, int32 gy, bool log=true)
 
static bool ExistVMap (uint32 mapid, int32 gx, int32 gy)
 

Private Member Functions

void LoadMapAndVMapImpl (int32 gx, int32 gy)
 
void LoadMMapInstanceImpl (uint32 mapId, uint32 instanceId)
 
void LoadMap (int32 gx, int32 gy)
 
void LoadVMap (int32 gx, int32 gy)
 
void LoadMMapImpl (uint32 instanceId, int32 gx, int32 gy)
 
void UnloadMapImpl (int32 gx, int32 gy)
 
void UnloadMMapInstanceImpl (uint32 mapId, uint32 instanceId)
 
GridMapGetGrid (uint32 mapId, float x, float y, bool loadIfMissing=true)
 

Static Private Member Functions

static constexpr int32 GetBitsetIndex (int32 gx, int32 gy)
 

Private Attributes

uint32 _mapId
 
TerrainInfo_parentTerrain
 
std::vector< std::shared_ptr< TerrainInfo > > _childTerrain
 
std::mutex _loadMutex
 
std::unique_ptr< GridMap_gridMap [MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
 
std::atomic< uint16_referenceCountFromMap [MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
 
std::array< uint64, MAX_NUMBER_OF_GRIDS_loadedGrids
 
std::bitset< MAX_NUMBER_OF_GRIDS *MAX_NUMBER_OF_GRIDS_gridFileExists
 
TimeTracker _cleanupTimer
 

Static Private Attributes

static constexpr Milliseconds CleanupInterval = 1min
 

Detailed Description

Definition at line 38 of file TerrainMgr.h.

Constructor & Destructor Documentation

◆ TerrainInfo() [1/3]

TerrainInfo::TerrainInfo ( uint32  mapId)
explicit

Definition at line 34 of file TerrainMgr.cpp.

◆ TerrainInfo() [2/3]

TerrainInfo::TerrainInfo ( TerrainInfo const &  )
delete

◆ TerrainInfo() [3/3]

TerrainInfo::TerrainInfo ( TerrainInfo &&  )
delete

◆ ~TerrainInfo()

TerrainInfo::~TerrainInfo ( )

Definition at line 38 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ AddChildTerrain()

void TerrainInfo::AddChildTerrain ( std::shared_ptr< TerrainInfo childTerrain)

Definition at line 150 of file TerrainMgr.cpp.

◆ CleanUpGrids()

void TerrainInfo::CleanUpGrids ( uint32  diff)

Definition at line 319 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ DiscoverGridMapFiles()

void TerrainInfo::DiscoverGridMapFiles ( )

Definition at line 49 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ ExistMap()

bool TerrainInfo::ExistMap ( uint32  mapid,
int32  gx,
int32  gy,
bool  log = true 
)
static

Definition at line 76 of file TerrainMgr.cpp.

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

◆ ExistVMap()

bool TerrainInfo::ExistVMap ( uint32  mapid,
int32  gx,
int32  gy 
)
static

Definition at line 109 of file TerrainMgr.cpp.

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

◆ GetAreaId() [1/2]

uint32 TerrainInfo::GetAreaId ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y,
float  z,
DynamicMapTree const *  dynamicMapTree = nullptr 
)

Definition at line 612 of file TerrainMgr.cpp.

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

◆ GetAreaId() [2/2]

uint32 TerrainInfo::GetAreaId ( PhaseShift const &  phaseShift,
uint32  mapId,
Position const &  pos,
DynamicMapTree const *  dynamicMapTree = nullptr 
)
inline

Definition at line 88 of file TerrainMgr.h.

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

◆ GetAreaInfo()

bool TerrainInfo::GetAreaInfo ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y,
float  z,
uint32 mogpflags,
int32 adtId,
int32 rootId,
int32 groupId,
DynamicMapTree const *  dynamicMapTree = nullptr 
)

Definition at line 572 of file TerrainMgr.cpp.

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

◆ GetBitsetIndex()

static constexpr int32 TerrainInfo::GetBitsetIndex ( int32  gx,
int32  gy 
)
inlinestaticconstexprprivate

Definition at line 106 of file TerrainMgr.h.

+ Here is the caller graph for this function:

◆ GetFullTerrainStatusForPosition()

void TerrainInfo::GetFullTerrainStatusForPosition ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y,
float  z,
PositionFullTerrainStatus data,
Optional< map_liquidHeaderTypeFlags reqLiquidType = {},
float  collisionHeight = 2.03128f,
DynamicMapTree const *  dynamicMapTree = nullptr 
)

Definition at line 340 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ GetGrid()

GridMap * TerrainInfo::GetGrid ( uint32  mapId,
float  x,
float  y,
bool  loadIfMissing = true 
)
private

Definition at line 295 of file TerrainMgr.cpp.

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

◆ GetGridHeight()

float TerrainInfo::GetGridHeight ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y 
)

Definition at line 674 of file TerrainMgr.cpp.

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

◆ GetId()

uint32 TerrainInfo::GetId ( ) const
inline

Definition at line 48 of file TerrainMgr.h.

+ Here is the caller graph for this function:

◆ GetLiquidStatus()

ZLiquidStatus TerrainInfo::GetLiquidStatus ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y,
float  z,
Optional< map_liquidHeaderTypeFlags ReqLiquidType = {},
LiquidData data = nullptr,
float  collisionHeight = 2.03128f 
)

Definition at line 479 of file TerrainMgr.cpp.

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

◆ GetMapName()

char const * TerrainInfo::GetMapName ( ) const

Definition at line 44 of file TerrainMgr.cpp.

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

◆ GetMinHeight()

float TerrainInfo::GetMinHeight ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y 
)

Definition at line 666 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ GetStaticHeight() [1/2]

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

Definition at line 682 of file TerrainMgr.cpp.

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

◆ GetStaticHeight() [2/2]

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

Definition at line 97 of file TerrainMgr.h.

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

◆ GetWaterLevel()

float TerrainInfo::GetWaterLevel ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y 
)

Definition at line 721 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ GetWaterOrGroundLevel()

float TerrainInfo::GetWaterOrGroundLevel ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y,
float  z,
float *  ground = nullptr,
bool  swim = false,
float  collisionHeight = 2.03128f,
DynamicMapTree const *  dynamicMapTree = nullptr 
)

Definition at line 741 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ GetZoneAndAreaId() [1/2]

void TerrainInfo::GetZoneAndAreaId ( PhaseShift const &  phaseShift,
uint32  mapId,
uint32 zoneid,
uint32 areaid,
float  x,
float  y,
float  z,
DynamicMapTree const *  dynamicMapTree = nullptr 
)

Definition at line 658 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ GetZoneAndAreaId() [2/2]

void TerrainInfo::GetZoneAndAreaId ( PhaseShift const &  phaseShift,
uint32  mapId,
uint32 zoneid,
uint32 areaid,
Position const &  pos,
DynamicMapTree const *  dynamicMapTree = nullptr 
)
inline

Definition at line 92 of file TerrainMgr.h.

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

◆ GetZoneId() [1/2]

uint32 TerrainInfo::GetZoneId ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y,
float  z,
DynamicMapTree const *  dynamicMapTree = nullptr 
)

Definition at line 648 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ GetZoneId() [2/2]

uint32 TerrainInfo::GetZoneId ( PhaseShift const &  phaseShift,
uint32  mapId,
Position const &  pos,
DynamicMapTree const *  dynamicMapTree = nullptr 
)
inline

Definition at line 90 of file TerrainMgr.h.

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

◆ HasChildTerrainGridFile()

bool TerrainInfo::HasChildTerrainGridFile ( uint32  mapId,
int32  gx,
int32  gy 
) const

Definition at line 144 of file TerrainMgr.cpp.

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

◆ IsInWater()

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

Definition at line 729 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ IsUnderWater()

bool TerrainInfo::IsUnderWater ( PhaseShift const &  phaseShift,
uint32  mapId,
float  x,
float  y,
float  z 
)

Definition at line 736 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ LoadMap()

void TerrainInfo::LoadMap ( int32  gx,
int32  gy 
)
private

Definition at line 197 of file TerrainMgr.cpp.

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

◆ LoadMapAndVMap()

void TerrainInfo::LoadMapAndVMap ( int32  gx,
int32  gy 
)

Definition at line 156 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ LoadMapAndVMapImpl()

void TerrainInfo::LoadMapAndVMapImpl ( int32  gx,
int32  gy 
)
private

Definition at line 181 of file TerrainMgr.cpp.

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

◆ LoadMMap()

void TerrainInfo::LoadMMap ( uint32  instanceId,
int32  gx,
int32  gy 
)

Definition at line 173 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ LoadMMapImpl()

void TerrainInfo::LoadMMapImpl ( uint32  instanceId,
int32  gx,
int32  gy 
)
private

Definition at line 242 of file TerrainMgr.cpp.

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

◆ LoadMMapInstance()

void TerrainInfo::LoadMMapInstance ( uint32  mapId,
uint32  instanceId 
)

Definition at line 165 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ LoadMMapInstanceImpl()

void TerrainInfo::LoadMMapInstanceImpl ( uint32  mapId,
uint32  instanceId 
)
private

Definition at line 192 of file TerrainMgr.cpp.

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

◆ LoadVMap()

void TerrainInfo::LoadVMap ( int32  gx,
int32  gy 
)
private

Definition at line 220 of file TerrainMgr.cpp.

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

◆ operator=() [1/2]

TerrainInfo & TerrainInfo::operator= ( TerrainInfo &&  )
delete

◆ operator=() [2/2]

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

◆ UnloadMap()

void TerrainInfo::UnloadMap ( int32  gx,
int32  gy 
)

Definition at line 264 of file TerrainMgr.cpp.

◆ UnloadMapImpl()

void TerrainInfo::UnloadMapImpl ( int32  gx,
int32  gy 
)
private

Definition at line 278 of file TerrainMgr.cpp.

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

◆ UnloadMMapInstance()

void TerrainInfo::UnloadMMapInstance ( uint32  mapId,
uint32  instanceId 
)

Definition at line 270 of file TerrainMgr.cpp.

+ Here is the call graph for this function:

◆ UnloadMMapInstanceImpl()

void TerrainInfo::UnloadMMapInstanceImpl ( uint32  mapId,
uint32  instanceId 
)
private

Definition at line 290 of file TerrainMgr.cpp.

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

Member Data Documentation

◆ _childTerrain

std::vector<std::shared_ptr<TerrainInfo> > TerrainInfo::_childTerrain
private

Definition at line 111 of file TerrainMgr.h.

◆ _cleanupTimer

TimeTracker TerrainInfo::_cleanupTimer
private

Definition at line 122 of file TerrainMgr.h.

◆ _gridFileExists

std::bitset<MAX_NUMBER_OF_GRIDS * MAX_NUMBER_OF_GRIDS> TerrainInfo::_gridFileExists
private

Definition at line 117 of file TerrainMgr.h.

◆ _gridMap

std::unique_ptr<GridMap> TerrainInfo::_gridMap[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
private

Definition at line 114 of file TerrainMgr.h.

◆ _loadedGrids

std::array<uint64, MAX_NUMBER_OF_GRIDS> TerrainInfo::_loadedGrids
private

Definition at line 116 of file TerrainMgr.h.

◆ _loadMutex

std::mutex TerrainInfo::_loadMutex
private

Definition at line 113 of file TerrainMgr.h.

◆ _mapId

uint32 TerrainInfo::_mapId
private

Definition at line 108 of file TerrainMgr.h.

◆ _parentTerrain

TerrainInfo* TerrainInfo::_parentTerrain
private

Definition at line 110 of file TerrainMgr.h.

◆ _referenceCountFromMap

std::atomic<uint16> TerrainInfo::_referenceCountFromMap[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]
private

Definition at line 115 of file TerrainMgr.h.

◆ CleanupInterval

constexpr Milliseconds TerrainInfo::CleanupInterval = 1min
staticconstexprprivate

Definition at line 119 of file TerrainMgr.h.


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