![]() |
TrinityCore
|
#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 |
Definition at line 99 of file VMapManager.h.
Definition at line 180 of file VMapManager.h.
Definition at line 183 of file VMapManager.h.
| VMAP::VMapManager::VMapManager | ( | ) |
Definition at line 58 of file VMapManager.cpp.
|
delete |
|
delete |
|
default |
| 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().
| 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().
| bool VMAP::VMapManager::getAreaAndLiquidData | ( | uint32 | mapId, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| Optional< uint8 > | reqLiquidType, | ||
| AreaAndLiquidData & | data | ||
| ) | const |
Query world model area info.
Definition at line 242 of file VMapManager.cpp.
References VMAP::ModelMinimalData::adtId, VMAP::AreaAndLiquidData::areaInfo, VMAP::convertPositionToInternalRep(), VMAP::AreaAndLiquidData::floorZ, GetLiquidFlagsPtr, VMAP::ModelInstance::GetLiquidLevel(), VMAP::GroupModel::GetLiquidType(), GetMapTree(), VMAP::GroupModel::GetMogpFlags(), VMAP::GroupModel::GetWmoID(), VMAP::LocationInfo::ground_Z, VMAP::StaticMapTreeLocationInfo::hitInstance, VMAP::LocationInfo::hitModel, VMAP::ModelMinimalData::ID, iInstanceMapTrees, IsVMAPDisabledForPtr, VMAP::AreaAndLiquidData::liquidInfo, VMAP::LocationInfo::rootId, VMAP::VMAP_DISABLE_AREAFLAG, and VMAP::VMAP_DISABLE_LIQUIDSTATUS.
Referenced by TerrainInfo::GetAreaInfo(), TerrainInfo::GetFullTerrainStatusForPosition(), and TerrainInfo::GetLiquidStatus().
|
inlinestatic |
Definition at line 170 of file VMapManager.h.
Referenced by TerrainInfo::ExistVMap().
| float VMAP::VMapManager::getHeight | ( | uint32 | mapId, |
| float | x, | ||
| float | y, | ||
| float | z, | ||
| float | maxSearchDist | ||
| ) |
get height or INVALID_HEIGHT if no height available
Definition at line 223 of file VMapManager.cpp.
References VMAP::convertPositionToInternalRep(), GetMapTree(), iInstanceMapTrees, isHeightCalcEnabled(), IsVMAPDisabledForPtr, VMAP::VMAP_DISABLE_HEIGHT, and VMAP_INVALID_HEIGHT_VALUE.
Referenced by TerrainInfo::GetStaticHeight().
|
static |
Definition at line 111 of file VMapManager.cpp.
References Trinity::StringFormat().
Referenced by VMAP::StaticMapTree::CanLoadMap(), and loadMap().
|
protected |
Definition at line 70 of file VMapManager.cpp.
References iInstanceMapTrees.
Referenced by getAreaAndLiquidData(), getHeight(), getModelsOnMap(), getObjectHitPos(), and isInLineOfSight().
| 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().
| 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().
Definition at line 322 of file VMapManager.cpp.
References iParentMapData.
Referenced by MMAP::TerrainBuilder::loadMap(), and VMAP::OpenMapTileFile().
|
static |
Definition at line 116 of file VMapManager.cpp.
References Trinity::StringFormat().
Referenced by VMAP::OpenMapTileFile().
| void VMAP::VMapManager::InitializeThreadUnsafe | ( | std::unordered_map< uint32, std::vector< uint32 > > const & | mapData | ) |
Definition at line 80 of file VMapManager.cpp.
References iInstanceMapTrees, iParentMapData, and thread_safe_environment.
Referenced by World::SetInitialWorldSettings().
Definition at line 93 of file VMapManager.cpp.
References iInstanceMapTrees, and iParentMapData.
|
inline |
Definition at line 144 of file VMapManager.h.
Referenced by getHeight(), TerrainInfo::GetStaticHeight(), and server_commandscript::HandleServerDebugCommand().
| bool VMAP::VMapManager::isInLineOfSight | ( | uint32 | mapId, |
| float | x1, | ||
| float | y1, | ||
| float | z1, | ||
| float | x2, | ||
| float | y2, | ||
| float | z2, | ||
| ModelIgnoreFlags | ignoreFlags | ||
| ) |
Definition at line 172 of file VMapManager.cpp.
References VMAP::convertPositionToInternalRep(), GetMapTree(), iInstanceMapTrees, isLineOfSightCalcEnabled(), IsVMAPDisabledForPtr, and VMAP::VMAP_DISABLE_LOS.
|
inline |
Definition at line 143 of file VMapManager.h.
Referenced by Spell::CheckCast(), getObjectHitPos(), server_commandscript::HandleServerDebugCommand(), and isInLineOfSight().
|
inline |
Definition at line 145 of file VMapManager.h.
Referenced by loadMap().
| LoadResult VMAP::VMapManager::loadMap | ( | std::string const & | basePath, |
| uint32 | mapId, | ||
| uint32 | x, | ||
| uint32 | y | ||
| ) |
Definition at line 121 of file VMapManager.cpp.
References ABORT_MSG, VMAP::DisabledInConfig, getMapFileName(), iInstanceMapTrees, isMapLoadingEnabled(), VMAP::Success, and thread_safe_environment.
Referenced by MMAP::TerrainBuilder::loadVMap().
|
delete |
|
delete |
| 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().
|
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().
|
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().
| void VMAP::VMapManager::unloadMap | ( | uint32 | mapId | ) |
Definition at line 161 of file VMapManager.cpp.
References iInstanceMapTrees.
Definition at line 150 of file VMapManager.cpp.
References iInstanceMapTrees.
Referenced by MMAP::TerrainBuilder::loadVMap(), TerrainInfo::UnloadMapImpl(), and TerrainInfo::~TerrainInfo().
| GetLiquidFlagsFn VMAP::VMapManager::GetLiquidFlagsPtr |
Definition at line 181 of file VMapManager.h.
Referenced by getAreaAndLiquidData(), MMAP::TerrainBuilder::loadVMapModel(), and World::SetInitialWorldSettings().
|
protected |
Definition at line 103 of file VMapManager.h.
|
protected |
Definition at line 102 of file VMapManager.h.
|
protected |
Definition at line 107 of file VMapManager.h.
Referenced by getAreaAndLiquidData(), getHeight(), GetMapTree(), getModelsOnMap(), getObjectHitPos(), InitializeThreadUnsafe(), InitializeThreadUnsafe(), isInLineOfSight(), loadMap(), unloadMap(), and unloadMap().
|
protected |
Definition at line 106 of file VMapManager.h.
Referenced by acquireModelInstance(), and releaseModelInstance().
Definition at line 108 of file VMapManager.h.
Referenced by getParentMapId(), InitializeThreadUnsafe(), and InitializeThreadUnsafe().
| IsVMAPDisabledForFn VMAP::VMapManager::IsVMAPDisabledForPtr |
Definition at line 184 of file VMapManager.h.
Referenced by getAreaAndLiquidData(), getHeight(), getObjectHitPos(), isInLineOfSight(), and World::SetInitialWorldSettings().
|
protected |
Definition at line 110 of file VMapManager.h.
Referenced by acquireModelInstance(), and releaseModelInstance().
| bool VMAP::VMapManager::LoadPathOnlyModels |
Definition at line 186 of file VMapManager.h.
Referenced by VMAP::StaticMapTree::LoadMapTile().
|
protected |
Definition at line 104 of file VMapManager.h.
Referenced by InitializeThreadUnsafe(), and loadMap().