Core/Vmaps: Rename VMapManager2 to VMapManager
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#include "RegularGrid.h"
|
||||
#include "Timer.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "WorldModel.h"
|
||||
#include <G3D/AABox.h>
|
||||
#include <G3D/Ray.h>
|
||||
|
||||
@@ -16,18 +16,18 @@
|
||||
*/
|
||||
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
VMapManager2* gVMapManager = nullptr;
|
||||
VMapManager* gVMapManager = nullptr;
|
||||
|
||||
//===============================================
|
||||
// just return the instance
|
||||
VMapManager2* VMapFactory::createOrGetVMapManager()
|
||||
VMapManager* VMapFactory::createOrGetVMapManager()
|
||||
{
|
||||
if (gVMapManager == nullptr)
|
||||
gVMapManager= new VMapManager2();
|
||||
gVMapManager= new VMapManager();
|
||||
return gVMapManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ This is the access point to the VMapManager.
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
class VMapManager2;
|
||||
class VMapManager;
|
||||
|
||||
class TC_COMMON_API VMapFactory
|
||||
{
|
||||
public:
|
||||
static VMapManager2* createOrGetVMapManager();
|
||||
static VMapManager* createOrGetVMapManager();
|
||||
static void clear();
|
||||
};
|
||||
|
||||
|
||||
+29
-29
@@ -15,7 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "Errors.h"
|
||||
#include "Log.h"
|
||||
#include "MapTree.h"
|
||||
@@ -29,7 +29,7 @@ namespace VMAP
|
||||
class ManagedModel
|
||||
{
|
||||
public:
|
||||
explicit ManagedModel(VMapManager2& mgr, std::string const& name) : _mgr(mgr), _name(name) { }
|
||||
explicit ManagedModel(VMapManager& mgr, std::string const& name) : _mgr(mgr), _name(name) { }
|
||||
|
||||
ManagedModel(ManagedModel const&) = delete;
|
||||
ManagedModel(ManagedModel&&) = delete;
|
||||
@@ -45,8 +45,8 @@ namespace VMAP
|
||||
WorldModel Model;
|
||||
|
||||
private:
|
||||
VMapManager2& _mgr;
|
||||
std::string const& _name; // valid only while model is held in VMapManager2::iLoadedModelFiles
|
||||
VMapManager& _mgr;
|
||||
std::string const& _name; // valid only while model is held in VMapManager::iLoadedModelFiles
|
||||
};
|
||||
|
||||
bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len)
|
||||
@@ -55,7 +55,7 @@ namespace VMAP
|
||||
return memcmp(dest, compare, len) == 0;
|
||||
}
|
||||
|
||||
VMapManager2::VMapManager2() :
|
||||
VMapManager::VMapManager() :
|
||||
iEnableLineOfSightCalc(true),
|
||||
iEnableHeightCalc(true),
|
||||
thread_safe_environment(true),
|
||||
@@ -64,9 +64,9 @@ namespace VMAP
|
||||
{
|
||||
}
|
||||
|
||||
VMapManager2::~VMapManager2() = default;
|
||||
VMapManager::~VMapManager() = default;
|
||||
|
||||
InstanceTreeMap::const_iterator VMapManager2::GetMapTree(uint32 mapId) const
|
||||
InstanceTreeMap::const_iterator VMapManager::GetMapTree(uint32 mapId) const
|
||||
{
|
||||
// return the iterator if found or end() if not found/NULL
|
||||
auto itr = iInstanceMapTrees.find(mapId);
|
||||
@@ -76,9 +76,9 @@ namespace VMAP
|
||||
return itr;
|
||||
}
|
||||
|
||||
void VMapManager2::InitializeThreadUnsafe(std::unordered_map<uint32, std::vector<uint32>> const& mapData)
|
||||
void VMapManager::InitializeThreadUnsafe(std::unordered_map<uint32, std::vector<uint32>> const& mapData)
|
||||
{
|
||||
// the caller must pass the list of all mapIds that will be used in the VMapManager2 lifetime
|
||||
// the caller must pass the list of all mapIds that will be used in the VMapManager lifetime
|
||||
for (auto const& [mapId, childMapIds] : mapData)
|
||||
{
|
||||
iInstanceMapTrees[mapId] = nullptr;
|
||||
@@ -89,7 +89,7 @@ namespace VMAP
|
||||
thread_safe_environment = false;
|
||||
}
|
||||
|
||||
void VMapManager2::InitializeThreadUnsafe(uint32 mapId, int32 parentMapId)
|
||||
void VMapManager::InitializeThreadUnsafe(uint32 mapId, int32 parentMapId)
|
||||
{
|
||||
iInstanceMapTrees[mapId] = nullptr;
|
||||
if (parentMapId >= 0)
|
||||
@@ -107,17 +107,17 @@ namespace VMAP
|
||||
return pos;
|
||||
}
|
||||
|
||||
std::string VMapManager2::getMapFileName(uint32 mapId)
|
||||
std::string VMapManager::getMapFileName(uint32 mapId)
|
||||
{
|
||||
return Trinity::StringFormat("{:04}/{:04}.vmtree", mapId, mapId);
|
||||
}
|
||||
|
||||
std::string VMapManager2::getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY, std::string_view extension)
|
||||
std::string VMapManager::getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY, std::string_view extension)
|
||||
{
|
||||
return Trinity::StringFormat("{:04}/{:04}_{:02}_{:02}.{}", mapID, mapID, tileY, tileX, extension);
|
||||
}
|
||||
|
||||
LoadResult VMapManager2::loadMap(std::string const& basePath, uint32 mapId, uint32 x, uint32 y)
|
||||
LoadResult VMapManager::loadMap(std::string const& basePath, uint32 mapId, uint32 x, uint32 y)
|
||||
{
|
||||
if (!isMapLoadingEnabled())
|
||||
return LoadResult::DisabledInConfig;
|
||||
@@ -128,7 +128,7 @@ namespace VMAP
|
||||
if (thread_safe_environment)
|
||||
instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, nullptr)).first;
|
||||
else
|
||||
ABORT_MSG("Invalid mapId %u tile [%u, %u] passed to VMapManager2 after startup in thread unsafe environment",
|
||||
ABORT_MSG("Invalid mapId %u tile [%u, %u] passed to VMapManager after startup in thread unsafe environment",
|
||||
mapId, x, y);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace VMAP
|
||||
return instanceTree->second->LoadMapTile(x, y, this);
|
||||
}
|
||||
|
||||
void VMapManager2::unloadMap(uint32 mapId, uint32 x, uint32 y)
|
||||
void VMapManager::unloadMap(uint32 mapId, uint32 x, uint32 y)
|
||||
{
|
||||
auto instanceTree = iInstanceMapTrees.find(mapId);
|
||||
if (instanceTree != iInstanceMapTrees.end() && instanceTree->second)
|
||||
@@ -157,7 +157,7 @@ namespace VMAP
|
||||
}
|
||||
}
|
||||
|
||||
void VMapManager2::unloadMap(uint32 mapId)
|
||||
void VMapManager::unloadMap(uint32 mapId)
|
||||
{
|
||||
auto instanceTree = iInstanceMapTrees.find(mapId);
|
||||
if (instanceTree != iInstanceMapTrees.end() && instanceTree->second)
|
||||
@@ -168,7 +168,7 @@ namespace VMAP
|
||||
}
|
||||
}
|
||||
|
||||
bool VMapManager2::isInLineOfSight(uint32 mapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags)
|
||||
bool VMapManager::isInLineOfSight(uint32 mapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags)
|
||||
{
|
||||
if (!isLineOfSightCalcEnabled() || IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
|
||||
return true;
|
||||
@@ -189,7 +189,7 @@ namespace VMAP
|
||||
get the hit position and return true if we hit something
|
||||
otherwise the result pos will be the dest pos
|
||||
*/
|
||||
bool VMapManager2::getObjectHitPos(uint32 mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist)
|
||||
bool VMapManager::getObjectHitPos(uint32 mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist)
|
||||
{
|
||||
if (isLineOfSightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
|
||||
{
|
||||
@@ -219,7 +219,7 @@ namespace VMAP
|
||||
get height or INVALID_HEIGHT if no height available
|
||||
*/
|
||||
|
||||
float VMapManager2::getHeight(uint32 mapId, float x, float y, float z, float maxSearchDist)
|
||||
float VMapManager::getHeight(uint32 mapId, float x, float y, float z, float maxSearchDist)
|
||||
{
|
||||
if (isHeightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_HEIGHT))
|
||||
{
|
||||
@@ -238,7 +238,7 @@ namespace VMAP
|
||||
return VMAP_INVALID_HEIGHT_VALUE;
|
||||
}
|
||||
|
||||
bool VMapManager2::getAreaAndLiquidData(uint32 mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const
|
||||
bool VMapManager::getAreaAndLiquidData(uint32 mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const
|
||||
{
|
||||
InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId);
|
||||
if (instanceTree != iInstanceMapTrees.end())
|
||||
@@ -267,7 +267,7 @@ namespace VMAP
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<WorldModel> VMapManager2::acquireModelInstance(std::string const& basepath, std::string const& filename)
|
||||
std::shared_ptr<WorldModel> VMapManager::acquireModelInstance(std::string const& basepath, std::string const& filename)
|
||||
{
|
||||
std::shared_ptr<ManagedModel> worldmodel; // this is intentionally declared before lock so that it is destroyed after it to prevent deadlocks in releaseModelInstance
|
||||
|
||||
@@ -282,34 +282,34 @@ namespace VMAP
|
||||
worldmodel = std::make_shared<ManagedModel>(*this, key);
|
||||
if (!worldmodel->Model.readFile(basepath + filename + ".vmo"))
|
||||
{
|
||||
TC_LOG_ERROR("misc", "VMapManager2: could not load '{}{}.vmo'", basepath, filename);
|
||||
TC_LOG_ERROR("misc", "VMapManager: could not load '{}{}.vmo'", basepath, filename);
|
||||
return nullptr;
|
||||
}
|
||||
TC_LOG_DEBUG("maps", "VMapManager2: loading file '{}{}'", basepath, filename);
|
||||
TC_LOG_DEBUG("maps", "VMapManager: loading file '{}{}'", basepath, filename);
|
||||
|
||||
model = worldmodel;
|
||||
|
||||
return std::shared_ptr<WorldModel>(worldmodel, &worldmodel->Model);
|
||||
}
|
||||
|
||||
void VMapManager2::releaseModelInstance(std::string const& filename)
|
||||
void VMapManager::releaseModelInstance(std::string const& filename)
|
||||
{
|
||||
//! Critical section, thread safe access to iLoadedModelFiles
|
||||
std::lock_guard lock(LoadedModelFilesLock);
|
||||
|
||||
TC_LOG_DEBUG("maps", "VMapManager2: unloading file '{}'", filename);
|
||||
TC_LOG_DEBUG("maps", "VMapManager: unloading file '{}'", filename);
|
||||
|
||||
std::size_t erased = iLoadedModelFiles.erase(filename);
|
||||
if (!erased)
|
||||
TC_LOG_ERROR("misc", "VMapManager2: trying to unload non-loaded file '{}'", filename);
|
||||
TC_LOG_ERROR("misc", "VMapManager: trying to unload non-loaded file '{}'", filename);
|
||||
}
|
||||
|
||||
LoadResult VMapManager2::existsMap(std::string const& basePath, uint32 mapId, uint32 x, uint32 y)
|
||||
LoadResult VMapManager::existsMap(std::string const& basePath, uint32 mapId, uint32 x, uint32 y)
|
||||
{
|
||||
return StaticMapTree::CanLoadMap(basePath, mapId, x, y, this);
|
||||
}
|
||||
|
||||
std::span<ModelInstance const> VMapManager2::getModelsOnMap(uint32 mapId) const
|
||||
std::span<ModelInstance const> VMapManager::getModelsOnMap(uint32 mapId) const
|
||||
{
|
||||
InstanceTreeMap::const_iterator mapTree = GetMapTree(mapId);
|
||||
if (mapTree != iInstanceMapTrees.end())
|
||||
@@ -318,7 +318,7 @@ namespace VMAP
|
||||
return {};
|
||||
}
|
||||
|
||||
int32 VMapManager2::getParentMapId(uint32 mapId) const
|
||||
int32 VMapManager::getParentMapId(uint32 mapId) const
|
||||
{
|
||||
auto itr = iParentMapData.find(mapId);
|
||||
if (itr != iParentMapData.end())
|
||||
+7
-7
@@ -96,7 +96,7 @@ namespace VMAP
|
||||
Optional<LiquidInfo> liquidInfo;
|
||||
};
|
||||
|
||||
class TC_COMMON_API VMapManager2
|
||||
class TC_COMMON_API VMapManager
|
||||
{
|
||||
protected:
|
||||
bool iEnableLineOfSightCalc;
|
||||
@@ -116,15 +116,15 @@ namespace VMAP
|
||||
static std::string getMapFileName(uint32 mapId);
|
||||
static std::string getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY, std::string_view extension);
|
||||
|
||||
VMapManager2();
|
||||
VMapManager();
|
||||
|
||||
VMapManager2(VMapManager2 const&) = delete;
|
||||
VMapManager2(VMapManager2&&) = delete;
|
||||
VMapManager(VMapManager const&) = delete;
|
||||
VMapManager(VMapManager&&) = delete;
|
||||
|
||||
VMapManager2& operator=(VMapManager2 const&) = delete;
|
||||
VMapManager2& operator=(VMapManager2&&) = delete;
|
||||
VMapManager& operator=(VMapManager const&) = delete;
|
||||
VMapManager& operator=(VMapManager&&) = delete;
|
||||
|
||||
~VMapManager2();
|
||||
~VMapManager();
|
||||
|
||||
void InitializeThreadUnsafe(std::unordered_map<uint32, std::vector<uint32>> const& mapData);
|
||||
void InitializeThreadUnsafe(uint32 mapId, int32 parentMapId);
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "Metric.h"
|
||||
#include "ModelInstance.h"
|
||||
#include "VMapDefinitions.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "WorldModel.h"
|
||||
#include <limits>
|
||||
#include <string>
|
||||
@@ -199,19 +199,19 @@ namespace VMAP
|
||||
explicit operator bool() const { return TileFile && SpawnIndicesFile; }
|
||||
};
|
||||
|
||||
TileFileOpenResult OpenMapTileFile(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager2* vm)
|
||||
TileFileOpenResult OpenMapTileFile(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager* vm)
|
||||
{
|
||||
TileFileOpenResult result;
|
||||
result.Name = basePath + VMapManager2::getTileFileName(mapID, tileX, tileY, "vmtile");
|
||||
result.Name = basePath + VMapManager::getTileFileName(mapID, tileX, tileY, "vmtile");
|
||||
result.TileFile.reset(fopen(result.Name.c_str(), "rb"));
|
||||
result.SpawnIndicesFile.reset(fopen((basePath + VMapManager2::getTileFileName(mapID, tileX, tileY, "vmtileidx")).c_str(), "rb"));
|
||||
result.SpawnIndicesFile.reset(fopen((basePath + VMapManager::getTileFileName(mapID, tileX, tileY, "vmtileidx")).c_str(), "rb"));
|
||||
result.UsedMapId = mapID;
|
||||
if (!result.TileFile)
|
||||
{
|
||||
int32 parentMapId = vm->getParentMapId(mapID);
|
||||
while (parentMapId != -1)
|
||||
{
|
||||
result.Name = basePath + VMapManager2::getTileFileName(parentMapId, tileX, tileY, "vmtile");
|
||||
result.Name = basePath + VMapManager::getTileFileName(parentMapId, tileX, tileY, "vmtile");
|
||||
result.TileFile.reset(fopen(result.Name.c_str(), "rb"));
|
||||
result.UsedMapId = parentMapId;
|
||||
if (result.TileFile)
|
||||
@@ -225,13 +225,13 @@ namespace VMAP
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
LoadResult StaticMapTree::CanLoadMap(std::string const& vmapPath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager2* vm)
|
||||
LoadResult StaticMapTree::CanLoadMap(std::string const& vmapPath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager* vm)
|
||||
{
|
||||
std::string basePath = vmapPath;
|
||||
if (!basePath.empty() && basePath.back() != '/' && basePath.back() != '\\')
|
||||
basePath.push_back('/');
|
||||
|
||||
std::string fullname = basePath + VMapManager2::getMapFileName(mapID);
|
||||
std::string fullname = basePath + VMapManager::getMapFileName(mapID);
|
||||
|
||||
auto rf = Trinity::make_unique_ptr_with_deleter<&::fclose>(fopen(fullname.c_str(), "rb"));
|
||||
if (!rf)
|
||||
@@ -285,7 +285,7 @@ namespace VMAP
|
||||
|
||||
//=========================================================
|
||||
|
||||
LoadResult StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm)
|
||||
LoadResult StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapManager* vm)
|
||||
{
|
||||
if (iTreeValues.empty())
|
||||
{
|
||||
@@ -369,7 +369,7 @@ namespace VMAP
|
||||
|
||||
//=========================================================
|
||||
|
||||
void StaticMapTree::UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm)
|
||||
void StaticMapTree::UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager* vm)
|
||||
{
|
||||
uint32 tileID = packTileID(tileX, tileY);
|
||||
loadedTileMap::iterator tile = iLoadedTiles.find(tileID);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace VMAP
|
||||
{
|
||||
class ModelInstance;
|
||||
class GroupModel;
|
||||
class VMapManager2;
|
||||
class VMapManager;
|
||||
enum class LoadResult : uint8;
|
||||
enum class ModelIgnoreFlags : uint32;
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace VMAP
|
||||
public:
|
||||
static uint32 packTileID(uint32 tileX, uint32 tileY) { return tileX << 16 | tileY; }
|
||||
static void unpackTileID(uint32 ID, uint32& tileX, uint32& tileY) { tileX = ID >> 16; tileY = ID & 0xFF; }
|
||||
static LoadResult CanLoadMap(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager2* vm);
|
||||
static LoadResult CanLoadMap(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager* vm);
|
||||
|
||||
StaticMapTree(uint32 mapID, std::string const& basePath);
|
||||
~StaticMapTree();
|
||||
@@ -78,8 +78,8 @@ namespace VMAP
|
||||
|
||||
LoadResult InitMap(std::string const& fname);
|
||||
void UnloadMap();
|
||||
LoadResult LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
|
||||
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
|
||||
LoadResult LoadMapTile(uint32 tileX, uint32 tileY, VMapManager* vm);
|
||||
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager* vm);
|
||||
uint32 numLoadedTiles() const { return uint32(iLoadedTiles.size()); }
|
||||
std::span<ModelInstance const> getModelInstances() const;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "VMapDefinitions.h"
|
||||
#include "WorldModel.h"
|
||||
#include "GameObjectModel.h"
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace VMAP
|
||||
const char RAW_VMAP_MAGIC[] = "VMAP04D"; // used in extracted vmap files with raw data
|
||||
const char GAMEOBJECT_MODELS[] = "GameObjectModels.dtree";
|
||||
|
||||
// defined in VMapManager2.cpp currently...
|
||||
// defined in VMapManager.cpp currently...
|
||||
bool readChunk(FILE* rf, char *dest, const char *compare, uint32 len);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "Player.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "StringConvert.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "World.h"
|
||||
|
||||
namespace DisableMgr
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "Util.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "World.h"
|
||||
#include <G3D/Vector3.h>
|
||||
#include <sstream>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
#include "Timer.h"
|
||||
#include "TransportMgr.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
#include "advstd.h"
|
||||
@@ -2197,7 +2197,7 @@ void ObjectMgr::LoadCreatures()
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_CREATURE_CHECK_INVALID_POSITION))
|
||||
{
|
||||
if (VMAP::VMapManager2* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
if (VMAP::VMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
{
|
||||
if (vmgr->isMapLoadingEnabled() && !IsTransportMap(data.mapId))
|
||||
{
|
||||
@@ -2553,7 +2553,7 @@ void ObjectMgr::LoadGameObjects()
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_GAME_OBJECT_CHECK_INVALID_POSITION))
|
||||
{
|
||||
if (VMAP::VMapManager2* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
if (VMAP::VMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
{
|
||||
if (vmgr->isMapLoadingEnabled() && !IsTransportMap(data.mapId))
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "TerrainMgr.h"
|
||||
#include "Transport.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Vignette.h"
|
||||
#include "VignettePackets.h"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "Util.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "World.h"
|
||||
#include <G3D/g3dmath.h>
|
||||
|
||||
@@ -109,12 +109,12 @@ bool TerrainInfo::ExistMap(uint32 mapid, int32 gx, int32 gy, bool log /*= true*/
|
||||
|
||||
bool TerrainInfo::ExistVMap(uint32 mapid, int32 gx, int32 gy)
|
||||
{
|
||||
if (VMAP::VMapManager2* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
if (VMAP::VMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
{
|
||||
if (vmgr->isMapLoadingEnabled())
|
||||
{
|
||||
VMAP::LoadResult result = vmgr->existsMap(sWorld->GetDataPath() + "vmaps", mapid, gx, gy);
|
||||
std::string name = VMAP::VMapManager2::getDirFileName(mapid, gx, gy);
|
||||
std::string name = VMAP::VMapManager::getDirFileName(mapid, gx, gy);
|
||||
switch (result)
|
||||
{
|
||||
case VMAP::LoadResult::Success:
|
||||
@@ -334,7 +334,7 @@ static bool IsInWMOInterior(uint32 mogpFlags)
|
||||
void TerrainInfo::GetFullTerrainStatusForPosition(PhaseShift const& phaseShift, uint32 mapId, float x, float y, float z, PositionFullTerrainStatus& data,
|
||||
Optional<map_liquidHeaderTypeFlags> reqLiquidType, float collisionHeight, DynamicMapTree const* dynamicMapTree)
|
||||
{
|
||||
VMAP::VMapManager2* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
VMAP::VMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
VMAP::AreaAndLiquidData vmapData;
|
||||
VMAP::AreaAndLiquidData dynData;
|
||||
VMAP::AreaAndLiquidData* wmoData = nullptr;
|
||||
@@ -484,7 +484,7 @@ void TerrainInfo::GetFullTerrainStatusForPosition(PhaseShift const& phaseShift,
|
||||
ZLiquidStatus TerrainInfo::GetLiquidStatus(PhaseShift const& phaseShift, uint32 mapId, float x, float y, float z, Optional<map_liquidHeaderTypeFlags> ReqLiquidType, LiquidData* data, float collisionHeight)
|
||||
{
|
||||
ZLiquidStatus result = LIQUID_MAP_NO_WATER;
|
||||
VMAP::VMapManager2* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
VMAP::VMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
VMAP::AreaAndLiquidData vmapData;
|
||||
bool useGridLiquid = true;
|
||||
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(phaseShift, mapId, this, x, y);
|
||||
@@ -585,7 +585,7 @@ bool TerrainInfo::GetAreaInfo(PhaseShift const& phaseShift, uint32 mapId, float
|
||||
{
|
||||
float check_z = z;
|
||||
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(phaseShift, mapId, this, x, y);
|
||||
VMAP::VMapManager2* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
VMAP::VMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
VMAP::AreaAndLiquidData vdata;
|
||||
VMAP::AreaAndLiquidData ddata;
|
||||
|
||||
@@ -703,7 +703,7 @@ float TerrainInfo::GetStaticHeight(PhaseShift const& phaseShift, uint32 mapId, f
|
||||
float vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||
if (checkVMap)
|
||||
{
|
||||
VMAP::VMapManager2* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
VMAP::VMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
if (vmgr->isHeightCalcEnabled())
|
||||
vmapHeight = vmgr->getHeight(terrainMapId, x, y, z, maxSearchDist);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
#include "Util.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
#include <numeric>
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
#include "Unit.h"
|
||||
#include "UpdateTime.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "WardenCheckMgr.h"
|
||||
#include "WaypointManager.h"
|
||||
#include "WeatherMgr.h"
|
||||
@@ -1247,7 +1247,7 @@ bool World::SetInitialWorldSettings()
|
||||
dtAllocSetCustom(dtCustomAlloc, dtCustomFree);
|
||||
|
||||
///- Initialize VMapManager function pointers (to untangle game/collision circular deps)
|
||||
VMAP::VMapManager2* vmmgr2 = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
VMAP::VMapManager* vmmgr2 = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
vmmgr2->GetLiquidFlagsPtr = &DB2Manager::GetLiquidFlags;
|
||||
vmmgr2->IsVMAPDisabledForPtr = &DisableMgr::IsVMAPDisabledFor;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ EndScriptData */
|
||||
#include "UpdateTime.h"
|
||||
#include "Util.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
#include <boost/filesystem/directory.hpp>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
class VMapManager2;
|
||||
class VMapManager;
|
||||
}
|
||||
|
||||
namespace MMAP
|
||||
@@ -141,7 +141,7 @@ namespace MMAP
|
||||
|
||||
namespace VMapFactory
|
||||
{
|
||||
std::unique_ptr<VMAP::VMapManager2> CreateVMapManager(uint32 mapId);
|
||||
std::unique_ptr<VMAP::VMapManager> CreateVMapManager(uint32 mapId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "PathCommon.h"
|
||||
#include "Timer.h"
|
||||
#include "Util.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
@@ -46,9 +46,9 @@ namespace MMAP
|
||||
|
||||
namespace VMapFactory
|
||||
{
|
||||
std::unique_ptr<VMAP::VMapManager2> CreateVMapManager(uint32 mapId)
|
||||
std::unique_ptr<VMAP::VMapManager> CreateVMapManager(uint32 mapId)
|
||||
{
|
||||
std::unique_ptr<VMAP::VMapManager2> vmgr = std::make_unique<VMAP::VMapManager2>();
|
||||
std::unique_ptr<VMAP::VMapManager> vmgr = std::make_unique<VMAP::VMapManager>();
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "ModelInstance.h"
|
||||
#include "StringFormat.h"
|
||||
#include "Util.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include <map>
|
||||
|
||||
namespace MMAP
|
||||
@@ -64,7 +64,7 @@ namespace MMAP
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager2* vmapManager)
|
||||
void TerrainBuilder::loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager* vmapManager)
|
||||
{
|
||||
if (loadMap(mapID, tileX, tileY, meshData, vmapManager, ENTIRE))
|
||||
{
|
||||
@@ -76,7 +76,7 @@ namespace MMAP
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
bool TerrainBuilder::loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager2* vmapManager, Spot portion)
|
||||
bool TerrainBuilder::loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager* vmapManager, Spot portion)
|
||||
{
|
||||
std::string mapFileName = Trinity::StringFormat("maps/{:04}_{:02}_{:02}.map", mapID, tileY, tileX);
|
||||
|
||||
@@ -579,7 +579,7 @@ namespace MMAP
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
bool TerrainBuilder::loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager2* vmapManager)
|
||||
bool TerrainBuilder::loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager* vmapManager)
|
||||
{
|
||||
VMAP::LoadResult result = vmapManager->loadMap("vmaps", mapID, tileX, tileY);
|
||||
bool retval = false;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
class VMapManager2;
|
||||
class VMapManager;
|
||||
}
|
||||
|
||||
enum class map_liquidHeaderTypeFlags : uint8;
|
||||
@@ -97,8 +97,8 @@ namespace MMAP
|
||||
public:
|
||||
explicit TerrainBuilder(bool skipLiquid);
|
||||
|
||||
void loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager2* vmapManager);
|
||||
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager2* vmapManager);
|
||||
void loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager* vmapManager);
|
||||
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager* vmapManager);
|
||||
void loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, std::vector<OffMeshData> const& offMeshConnections);
|
||||
|
||||
bool usesLiquids() const { return !m_skipLiquid; }
|
||||
@@ -112,7 +112,7 @@ namespace MMAP
|
||||
static void cleanVertices(G3D::Array<float>& verts, G3D::Array<int>& tris);
|
||||
private:
|
||||
/// Loads a portion of a map's terrain
|
||||
bool loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager2* vmapManager, Spot portion);
|
||||
bool loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, VMAP::VMapManager* vmapManager, Spot portion);
|
||||
|
||||
/// Sets loop variables for selecting only certain parts of a map's terrain
|
||||
void getLoopVars(Spot portion, int& loopStart, int& loopEnd, int& loopInc);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "MMapDefines.h"
|
||||
#include "PathCommon.h"
|
||||
#include "StringFormat.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapManager.h"
|
||||
#include <DetourNavMeshBuilder.h>
|
||||
|
||||
namespace
|
||||
@@ -95,7 +95,7 @@ namespace MMAP
|
||||
|
||||
MeshData meshData;
|
||||
|
||||
std::unique_ptr<VMAP::VMapManager2> vmapManager = VMapFactory::CreateVMapManager(mapID);
|
||||
std::unique_ptr<VMAP::VMapManager> vmapManager = VMapFactory::CreateVMapManager(mapID);
|
||||
|
||||
// get heightmap data
|
||||
m_terrainBuilder.loadMap(mapID, tileX, tileY, meshData, vmapManager.get());
|
||||
|
||||
Reference in New Issue
Block a user