TrinityCore
Loading...
Searching...
No Matches
VMAP::VMapManager Class Reference

#include <VMapManager.h>

Public Types

typedef uint32(* GetLiquidFlagsFn) (uint32 liquidType)
 
typedef bool(* IsVMAPDisabledForFn) (uint32 entry, uint8 flags)
 

Public Member Functions

 VMapManager ()
 
 VMapManager (VMapManager const &)=delete
 
 VMapManager (VMapManager &&)=delete
 
VMapManager & operator= (VMapManager const &)=delete
 
VMapManager & operator= (VMapManager &&)=delete
 
 ~VMapManager ()
 
void InitializeThreadUnsafe (std::unordered_map< uint32, std::vector< uint32 > > const &mapData)
 
void InitializeThreadUnsafe (uint32 mapId, int32 parentMapId)
 
void setEnableLineOfSightCalc (bool enableLineOfSightCalc)
 
void setEnableHeightCalc (bool enableHeightCalc)
 
bool isLineOfSightCalcEnabled () const
 
bool isHeightCalcEnabled () const
 
bool isMapLoadingEnabled () const
 
LoadResult loadMap (std::string const &basePath, uint32 mapId, uint32 x, uint32 y)
 
void unloadMap (uint32 mapId, uint32 x, uint32 y)
 
void unloadMap (uint32 mapId)
 
bool isInLineOfSight (uint32 mapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags)
 
bool getObjectHitPos (uint32 mapId, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist)
 
float getHeight (uint32 mapId, float x, float y, float z, float maxSearchDist)
 
bool getAreaAndLiquidData (uint32 mapId, float x, float y, float z, Optional< uint8 > reqLiquidType, AreaAndLiquidData &data) const
 
std::shared_ptr< WorldModel > acquireModelInstance (std::string const &basepath, std::string const &filename)
 
void releaseModelInstance (std::string const &filename)
 
LoadResult existsMap (std::string const &basePath, uint32 mapId, uint32 x, uint32 y)
 
std::span< ModelInstance const > getModelsOnMap (uint32 mapId) const
 
int32 getParentMapId (uint32 mapId) const
 

Static Public Member Functions

static std::string getMapFileName (uint32 mapId)
 
static std::string getTileFileName (uint32 mapID, uint32 tileX, uint32 tileY, std::string_view extension)
 
static std::string getDirFileName (uint32 mapId, uint32 x, uint32 y)
 

Public Attributes

GetLiquidFlagsFn GetLiquidFlagsPtr
 
IsVMAPDisabledForFn IsVMAPDisabledForPtr
 
bool LoadPathOnlyModels
 

Protected Member Functions

InstanceTreeMap::const_iterator GetMapTree (uint32 mapId) const
 

Protected Attributes

bool iEnableLineOfSightCalc
 
bool iEnableHeightCalc
 
bool thread_safe_environment
 
ModelFileMap iLoadedModelFiles
 
InstanceTreeMap iInstanceMapTrees
 
std::unordered_map< uint32, uint32 > iParentMapData
 
std::mutex LoadedModelFilesLock
 

Detailed Description

Definition at line 99 of file VMapManager.h.

Member Typedef Documentation

◆ GetLiquidFlagsFn

typedef uint32(* VMAP::VMapManager::GetLiquidFlagsFn) (uint32 liquidType)

Definition at line 180 of file VMapManager.h.

◆ IsVMAPDisabledForFn

typedef bool(* VMAP::VMapManager::IsVMAPDisabledForFn) (uint32 entry, uint8 flags)

Definition at line 183 of file VMapManager.h.

Constructor & Destructor Documentation

◆ VMapManager() [1/3]

VMAP::VMapManager::VMapManager ( )

Definition at line 58 of file VMapManager.cpp.

◆ VMapManager() [2/3]

VMAP::VMapManager::VMapManager ( VMapManager const &  )
delete

◆ VMapManager() [3/3]

VMAP::VMapManager::VMapManager ( VMapManager &&  )
delete

◆ ~VMapManager()

VMAP::VMapManager::~VMapManager ( )
default

Member Function Documentation

◆ acquireModelInstance()

std::shared_ptr< WorldModel > VMAP::VMapManager::acquireModelInstance ( std::string const &  basepath,
std::string const &  filename 
)

Critical section, thread safe access to iLoadedModelFiles

Definition at line 271 of file VMapManager.cpp.

References iLoadedModelFiles, LoadedModelFilesLock, TC_LOG_DEBUG, and TC_LOG_ERROR.

Referenced by GameObjectModel::initialize(), and VMAP::StaticMapTree::LoadMapTile().

◆ existsMap()

LoadResult VMAP::VMapManager::existsMap ( std::string const &  basePath,
uint32  mapId,
uint32  x,
uint32  y 
)

Definition at line 308 of file VMapManager.cpp.

References VMAP::StaticMapTree::CanLoadMap().

◆ getAreaAndLiquidData()

◆ getDirFileName()

static std::string VMAP::VMapManager::getDirFileName ( uint32  mapId,
uint32  x,
uint32  y 
)
inlinestatic

Definition at line 170 of file VMapManager.h.

Referenced by TerrainInfo::ExistVMap().

◆ getHeight()

float VMAP::VMapManager::getHeight ( uint32  mapId,
float  x,
float  y,
float  z,
float  maxSearchDist 
)

◆ getMapFileName()

std::string VMAP::VMapManager::getMapFileName ( uint32  mapId)
static

Definition at line 111 of file VMapManager.cpp.

References Trinity::StringFormat().

Referenced by VMAP::StaticMapTree::CanLoadMap(), and loadMap().

◆ GetMapTree()

InstanceTreeMap::const_iterator VMAP::VMapManager::GetMapTree ( uint32  mapId) const
protected

◆ getModelsOnMap()

std::span< ModelInstance const > VMAP::VMapManager::getModelsOnMap ( uint32  mapId) const

Definition at line 313 of file VMapManager.cpp.

References GetMapTree(), and iInstanceMapTrees.

Referenced by MMAP::TerrainBuilder::loadVMap().

◆ getObjectHitPos()

bool VMAP::VMapManager::getObjectHitPos ( uint32  mapId,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
float &  rx,
float &  ry,
float &  rz,
float  modifyDist 
)

test if we hit an object. return true if we hit one. rx, ry, rz will hold the hit position or the dest position, if no intersection was found return a position, that is modifyDist closer to the origin

get the hit position and return true if we hit something otherwise the result pos will be the dest pos

Definition at line 193 of file VMapManager.cpp.

References VMAP::convertPositionToInternalRep(), GetMapTree(), iInstanceMapTrees, isLineOfSightCalcEnabled(), IsVMAPDisabledForPtr, and VMAP::VMAP_DISABLE_LOS.

Referenced by WorldObject::MovePositionToFirstCollision().

◆ getParentMapId()

int32 VMAP::VMapManager::getParentMapId ( uint32  mapId) const

Definition at line 322 of file VMapManager.cpp.

References iParentMapData.

Referenced by MMAP::TerrainBuilder::loadMap(), and VMAP::OpenMapTileFile().

◆ getTileFileName()

std::string VMAP::VMapManager::getTileFileName ( uint32  mapID,
uint32  tileX,
uint32  tileY,
std::string_view  extension 
)
static

Definition at line 116 of file VMapManager.cpp.

References Trinity::StringFormat().

Referenced by VMAP::OpenMapTileFile().

◆ InitializeThreadUnsafe() [1/2]

void VMAP::VMapManager::InitializeThreadUnsafe ( std::unordered_map< uint32, std::vector< uint32 > > const &  mapData)

◆ InitializeThreadUnsafe() [2/2]

void VMAP::VMapManager::InitializeThreadUnsafe ( uint32  mapId,
int32  parentMapId 
)

Definition at line 93 of file VMapManager.cpp.

References iInstanceMapTrees, and iParentMapData.

◆ isHeightCalcEnabled()

bool VMAP::VMapManager::isHeightCalcEnabled ( ) const
inline

◆ isInLineOfSight()

bool VMAP::VMapManager::isInLineOfSight ( uint32  mapId,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2,
ModelIgnoreFlags  ignoreFlags 
)

◆ isLineOfSightCalcEnabled()

bool VMAP::VMapManager::isLineOfSightCalcEnabled ( ) const
inline

◆ isMapLoadingEnabled()

bool VMAP::VMapManager::isMapLoadingEnabled ( ) const
inline

Definition at line 145 of file VMapManager.h.

Referenced by loadMap().

◆ loadMap()

LoadResult VMAP::VMapManager::loadMap ( std::string const &  basePath,
uint32  mapId,
uint32  x,
uint32  y 
)

◆ operator=() [1/2]

VMapManager & VMAP::VMapManager::operator= ( VMapManager &&  )
delete

◆ operator=() [2/2]

VMapManager & VMAP::VMapManager::operator= ( VMapManager const &  )
delete

◆ releaseModelInstance()

void VMAP::VMapManager::releaseModelInstance ( std::string const &  filename)

Critical section, thread safe access to iLoadedModelFiles

Definition at line 296 of file VMapManager.cpp.

References iLoadedModelFiles, LoadedModelFilesLock, TC_LOG_DEBUG, and TC_LOG_ERROR.

Referenced by VMAP::ManagedModel::~ManagedModel().

◆ setEnableHeightCalc()

void VMAP::VMapManager::setEnableHeightCalc ( bool  enableHeightCalc)
inline

Enable/disable model height calculation It is enabled by default. If it is enabled in mid game the maps have to loaded manualy

Definition at line 141 of file VMapManager.h.

Referenced by World::LoadConfigSettings().

◆ setEnableLineOfSightCalc()

void VMAP::VMapManager::setEnableLineOfSightCalc ( bool  enableLineOfSightCalc)
inline

Enable/disable LOS calculation It is enabled by default. If it is enabled in mid game the maps have to loaded manualy

Definition at line 135 of file VMapManager.h.

Referenced by World::LoadConfigSettings().

◆ unloadMap() [1/2]

void VMAP::VMapManager::unloadMap ( uint32  mapId)

Definition at line 161 of file VMapManager.cpp.

References iInstanceMapTrees.

◆ unloadMap() [2/2]

void VMAP::VMapManager::unloadMap ( uint32  mapId,
uint32  x,
uint32  y 
)

Member Data Documentation

◆ GetLiquidFlagsPtr

GetLiquidFlagsFn VMAP::VMapManager::GetLiquidFlagsPtr

◆ iEnableHeightCalc

bool VMAP::VMapManager::iEnableHeightCalc
protected

Definition at line 103 of file VMapManager.h.

◆ iEnableLineOfSightCalc

bool VMAP::VMapManager::iEnableLineOfSightCalc
protected

Definition at line 102 of file VMapManager.h.

◆ iInstanceMapTrees

◆ iLoadedModelFiles

ModelFileMap VMAP::VMapManager::iLoadedModelFiles
protected

Definition at line 106 of file VMapManager.h.

Referenced by acquireModelInstance(), and releaseModelInstance().

◆ iParentMapData

std::unordered_map<uint32, uint32> VMAP::VMapManager::iParentMapData
protected

Definition at line 108 of file VMapManager.h.

Referenced by getParentMapId(), InitializeThreadUnsafe(), and InitializeThreadUnsafe().

◆ IsVMAPDisabledForPtr

IsVMAPDisabledForFn VMAP::VMapManager::IsVMAPDisabledForPtr

◆ LoadedModelFilesLock

std::mutex VMAP::VMapManager::LoadedModelFilesLock
protected

Definition at line 110 of file VMapManager.h.

Referenced by acquireModelInstance(), and releaseModelInstance().

◆ LoadPathOnlyModels

bool VMAP::VMapManager::LoadPathOnlyModels

Definition at line 186 of file VMapManager.h.

Referenced by VMAP::StaticMapTree::LoadMapTile().

◆ thread_safe_environment

bool VMAP::VMapManager::thread_safe_environment
protected

Definition at line 104 of file VMapManager.h.

Referenced by InitializeThreadUnsafe(), and loadMap().


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