mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
refactor(Core): Rename ...Manager to ...Mgr (#6910)
* Rename MapManager.h to MapMgr.h * Rename BanManager.h to BanMgr.h * Rename MapManager.cpp to MapMgr.cpp * Rename BanManager.cpp to BanMgr.cpp * Rename MapRefManager.h to MapRefMgr.h * Rename ThreatManager.h to ThreatMgr.h * Rename GridRefManager.h to GridRefMgr.h * Rename ThreatManager.cpp to ThreatMgr.cpp * Rename GroupRefManager.h to GroupRefMgr.h * Rename HostileRefManager.h to HostileRefMgr.h * Rename HostileRefManager.cpp to HostileRefMgr.cpp * Rename MMapManager.h to MMapMgr.h * Rename FollowerRefManager.h to FollowerRefMgr.h * Rename VMapManager2.h to VMapMgr2.h * Rename IVMapManager.h to IVMapMgr.h * Rename MMapManager.cpp to MMapMgr.cpp * Rename VMapManager2.cpp to VMapMgr2.cpp * Rename RefManager.h to RefMgr.h * Rename WaypointManager.h to WaypointMgr.h * Rename WaypointManager.cpp to WaypointMgr.cpp * Rename MPQManager.h to MPQMgr.h * Rename MPQManager.cpp to MPQMgr.cpp * Rename IMMAPManager.h to IMMAPMgr.h * fix build * Update Main.cpp * chore(Core/Misc): Remove toxic language * Revert "chore(Core/Misc): Remove toxic language" * fix build * build
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#include "RegularGrid.h"
|
||||
#include "Timer.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapMgr2.h"
|
||||
#include "WorldModel.h"
|
||||
|
||||
#include <G3D/AABox.h>
|
||||
@@ -317,7 +317,7 @@ void DynamicMapTree::GetAreaAndLiquidData(float x, float y, float z, uint32 phas
|
||||
data.floorZ = intersectionCallBack.GetLocationInfo().ground_Z;
|
||||
uint32 liquidType = intersectionCallBack.GetLocationInfo().hitModel->GetLiquidType();
|
||||
float liquidLevel;
|
||||
if (!reqLiquidType || (dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager())->GetLiquidFlagsPtr(liquidType) & reqLiquidType))
|
||||
if (!reqLiquidType || (dynamic_cast<VMAP::VMapMgr2*>(VMAP::VMapFactory::createOrGetVMapMgr())->GetLiquidFlagsPtr(liquidType) & reqLiquidType))
|
||||
if (intersectionCallBack.GetHitModel()->GetLiquidLevel(v, intersectionCallBack.GetLocationInfo(), liquidLevel))
|
||||
data.liquidInfo.emplace(liquidType, liquidLevel);
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@ namespace MMAP
|
||||
MMAP_LOAD_RESULT_IGNORED,
|
||||
};
|
||||
|
||||
class IMMapManager
|
||||
class IMMapMgr
|
||||
{
|
||||
private:
|
||||
bool iEnablePathFinding;
|
||||
|
||||
public:
|
||||
IMMapManager() : iEnablePathFinding(true) {}
|
||||
virtual ~IMMapManager(void) {}
|
||||
IMMapMgr() : iEnablePathFinding(true) {}
|
||||
virtual ~IMMapMgr(void) {}
|
||||
|
||||
//Enabled/Disabled Pathfinding
|
||||
void setEnablePathFinding(bool value) { iEnablePathFinding = value; }
|
||||
@@ -55,16 +55,16 @@ namespace VMAP
|
||||
};
|
||||
|
||||
//===========================================================
|
||||
class IVMapManager
|
||||
class IVMapMgr
|
||||
{
|
||||
private:
|
||||
bool iEnableLineOfSightCalc{true};
|
||||
bool iEnableHeightCalc{true};
|
||||
|
||||
public:
|
||||
IVMapManager() { }
|
||||
IVMapMgr() { }
|
||||
|
||||
virtual ~IVMapManager() = default;
|
||||
virtual ~IVMapMgr() = default;
|
||||
|
||||
virtual int loadMap(const char* pBasePath, unsigned int pMapId, int x, int y) = 0;
|
||||
|
||||
@@ -12,17 +12,17 @@ namespace MMAP
|
||||
{
|
||||
// ######################## MMapFactory ########################
|
||||
// our global singleton copy
|
||||
MMapManager* g_MMapManager = nullptr;
|
||||
MMapMgr* g_MMapMgr = nullptr;
|
||||
bool MMapFactory::forbiddenMaps[1000] = {0};
|
||||
|
||||
MMapManager* MMapFactory::createOrGetMMapManager()
|
||||
MMapMgr* MMapFactory::createOrGetMMapMgr()
|
||||
{
|
||||
if (g_MMapManager == nullptr)
|
||||
if (g_MMapMgr == nullptr)
|
||||
{
|
||||
g_MMapManager = new MMapManager();
|
||||
g_MMapMgr = new MMapMgr();
|
||||
}
|
||||
|
||||
return g_MMapManager;
|
||||
return g_MMapMgr;
|
||||
}
|
||||
|
||||
void MMapFactory::InitializeDisabledMaps()
|
||||
@@ -38,10 +38,10 @@ namespace MMAP
|
||||
|
||||
void MMapFactory::clear()
|
||||
{
|
||||
if (g_MMapManager)
|
||||
if (g_MMapMgr)
|
||||
{
|
||||
delete g_MMapManager;
|
||||
g_MMapManager = nullptr;
|
||||
delete g_MMapMgr;
|
||||
g_MMapMgr = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "DetourAlloc.h"
|
||||
#include "DetourExtended.h"
|
||||
#include "DetourNavMesh.h"
|
||||
#include "MMapManager.h"
|
||||
#include "MMapMgr.h"
|
||||
#include <unordered_map>
|
||||
|
||||
namespace MMAP
|
||||
@@ -24,11 +24,11 @@ namespace MMAP
|
||||
|
||||
// static class
|
||||
// holds all mmap global data
|
||||
// access point to MMapManager singleton
|
||||
// access point to MMapMgr singleton
|
||||
class MMapFactory
|
||||
{
|
||||
public:
|
||||
static MMapManager* createOrGetMMapManager();
|
||||
static MMapMgr* createOrGetMMapMgr();
|
||||
static void clear();
|
||||
static void InitializeDisabledMaps();
|
||||
static bool forbiddenMaps[1000];
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "MMapManager.h"
|
||||
#include "MMapMgr.h"
|
||||
#include "Config.h"
|
||||
#include "Errors.h"
|
||||
#include "Log.h"
|
||||
@@ -16,8 +16,8 @@ namespace MMAP
|
||||
static char const* const MAP_FILE_NAME_FORMAT = "%s/mmaps/%03i.mmap";
|
||||
static char const* const TILE_FILE_NAME_FORMAT = "%s/mmaps/%03i%02i%02i.mmtile";
|
||||
|
||||
// ######################## MMapManager ########################
|
||||
MMapManager::~MMapManager()
|
||||
// ######################## MMapMgr ########################
|
||||
MMapMgr::~MMapMgr()
|
||||
{
|
||||
for (MMapDataSet::iterator i = loadedMMaps.begin(); i != loadedMMaps.end(); ++i)
|
||||
{
|
||||
@@ -28,9 +28,9 @@ namespace MMAP
|
||||
// if we had, tiles in MMapData->mmapLoadedTiles, their actual data is lost!
|
||||
}
|
||||
|
||||
void MMapManager::InitializeThreadUnsafe(const std::vector<uint32>& mapIds)
|
||||
void MMapMgr::InitializeThreadUnsafe(const std::vector<uint32>& mapIds)
|
||||
{
|
||||
// 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 VMapMgr2 lifetime
|
||||
for (const uint32& mapId : mapIds)
|
||||
{
|
||||
loadedMMaps.emplace(mapId, nullptr);
|
||||
@@ -39,7 +39,7 @@ namespace MMAP
|
||||
thread_safe_environment = false;
|
||||
}
|
||||
|
||||
MMapDataSet::const_iterator MMapManager::GetMMapData(uint32 mapId) const
|
||||
MMapDataSet::const_iterator MMapMgr::GetMMapData(uint32 mapId) const
|
||||
{
|
||||
// return the iterator if found or end() if not found/NULL
|
||||
MMapDataSet::const_iterator itr = loadedMMaps.find(mapId);
|
||||
@@ -51,7 +51,7 @@ namespace MMAP
|
||||
return itr;
|
||||
}
|
||||
|
||||
bool MMapManager::loadMapData(uint32 mapId)
|
||||
bool MMapMgr::loadMapData(uint32 mapId)
|
||||
{
|
||||
// we already have this map loaded?
|
||||
MMapDataSet::iterator itr = loadedMMaps.find(mapId);
|
||||
@@ -70,7 +70,7 @@ namespace MMAP
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(false, "Invalid mapId %u passed to MMapManager after startup in thread unsafe environment", mapId);
|
||||
ASSERT(false, "Invalid mapId %u passed to MMapMgr after startup in thread unsafe environment", mapId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,12 +110,12 @@ namespace MMAP
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 MMapManager::packTileID(int32 x, int32 y)
|
||||
uint32 MMapMgr::packTileID(int32 x, int32 y)
|
||||
{
|
||||
return uint32(x << 16 | y);
|
||||
}
|
||||
|
||||
bool MMapManager::loadMap(uint32 mapId, int32 x, int32 y)
|
||||
bool MMapMgr::loadMap(uint32 mapId, int32 x, int32 y)
|
||||
{
|
||||
// make sure the mmap is loaded and ready to load tiles
|
||||
if (!loadMapData(mapId))
|
||||
@@ -191,7 +191,7 @@ namespace MMAP
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MMapManager::unloadMap(uint32 mapId, int32 x, int32 y)
|
||||
bool MMapMgr::unloadMap(uint32 mapId, int32 x, int32 y)
|
||||
{
|
||||
// check if we have this map loaded
|
||||
MMapDataSet::const_iterator itr = GetMMapData(mapId);
|
||||
@@ -231,7 +231,7 @@ namespace MMAP
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MMapManager::unloadMap(uint32 mapId)
|
||||
bool MMapMgr::unloadMap(uint32 mapId)
|
||||
{
|
||||
MMapDataSet::iterator itr = loadedMMaps.find(mapId);
|
||||
if (itr == loadedMMaps.end() || !itr->second)
|
||||
@@ -266,7 +266,7 @@ namespace MMAP
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MMapManager::unloadMapInstance(uint32 mapId, uint32 instanceId)
|
||||
bool MMapMgr::unloadMapInstance(uint32 mapId, uint32 instanceId)
|
||||
{
|
||||
// check if we have this map loaded
|
||||
MMapDataSet::const_iterator itr = GetMMapData(mapId);
|
||||
@@ -293,7 +293,7 @@ namespace MMAP
|
||||
return true;
|
||||
}
|
||||
|
||||
dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId)
|
||||
dtNavMesh const* MMapMgr::GetNavMesh(uint32 mapId)
|
||||
{
|
||||
MMapDataSet::const_iterator itr = GetMMapData(mapId);
|
||||
if (itr == loadedMMaps.end())
|
||||
@@ -304,7 +304,7 @@ namespace MMAP
|
||||
return itr->second->navMesh;
|
||||
}
|
||||
|
||||
dtNavMeshQuery const* MMapManager::GetNavMeshQuery(uint32 mapId, uint32 instanceId)
|
||||
dtNavMeshQuery const* MMapMgr::GetNavMeshQuery(uint32 mapId, uint32 instanceId)
|
||||
{
|
||||
MMapDataSet::const_iterator itr = GetMMapData(mapId);
|
||||
if (itr == loadedMMaps.end())
|
||||
@@ -60,11 +60,11 @@ namespace MMAP
|
||||
|
||||
// singleton class
|
||||
// holds all all access to mmap loading unloading and meshes
|
||||
class MMapManager
|
||||
class MMapMgr
|
||||
{
|
||||
public:
|
||||
MMapManager() : loadedTiles(0), thread_safe_environment(true) { }
|
||||
~MMapManager();
|
||||
MMapMgr() : loadedTiles(0), thread_safe_environment(true) { }
|
||||
~MMapMgr();
|
||||
|
||||
void InitializeThreadUnsafe(const std::vector<uint32>& mapIds);
|
||||
bool loadMap(uint32 mapId, int32 x, int32 y);
|
||||
@@ -5,29 +5,29 @@
|
||||
*/
|
||||
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapMgr2.h"
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
VMapManager2* gVMapManager = nullptr;
|
||||
VMapMgr2* gVMapMgr = nullptr;
|
||||
|
||||
//===============================================
|
||||
// just return the instance
|
||||
VMapManager2* VMapFactory::createOrGetVMapManager()
|
||||
VMapMgr2* VMapFactory::createOrGetVMapMgr()
|
||||
{
|
||||
if (!gVMapManager)
|
||||
if (!gVMapMgr)
|
||||
{
|
||||
gVMapManager = new VMapManager2();
|
||||
gVMapMgr = new VMapMgr2();
|
||||
}
|
||||
|
||||
return gVMapManager;
|
||||
return gVMapMgr;
|
||||
}
|
||||
|
||||
//===============================================
|
||||
// delete all internal data structures
|
||||
void VMapFactory::clear()
|
||||
{
|
||||
delete gVMapManager;
|
||||
gVMapManager = nullptr;
|
||||
delete gVMapMgr;
|
||||
gVMapMgr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,17 +7,17 @@
|
||||
#ifndef _VMAPFACTORY_H
|
||||
#define _VMAPFACTORY_H
|
||||
|
||||
#include "IVMapManager.h"
|
||||
#include "IVMapMgr.h"
|
||||
|
||||
// This is the access point to the VMapManager.
|
||||
// This is the access point to the VMapMgr.
|
||||
namespace VMAP
|
||||
{
|
||||
class VMapManager2;
|
||||
class VMapMgr2;
|
||||
|
||||
class VMapFactory
|
||||
{
|
||||
public:
|
||||
static VMapManager2* createOrGetVMapManager();
|
||||
static VMapMgr2* createOrGetVMapMgr();
|
||||
static void clear();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapMgr2.h"
|
||||
#include "Errors.h"
|
||||
#include "Log.h"
|
||||
#include "MapDefines.h"
|
||||
@@ -32,14 +32,14 @@ using G3D::Vector3;
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
VMapManager2::VMapManager2()
|
||||
VMapMgr2::VMapMgr2()
|
||||
{
|
||||
GetLiquidFlagsPtr = &GetLiquidFlagsDummy;
|
||||
IsVMAPDisabledForPtr = &IsVMAPDisabledForDummy;
|
||||
thread_safe_environment = true;
|
||||
}
|
||||
|
||||
VMapManager2::~VMapManager2()
|
||||
VMapMgr2::~VMapMgr2()
|
||||
{
|
||||
for (InstanceTreeMap::iterator i = iInstanceMapTrees.begin(); i != iInstanceMapTrees.end(); ++i)
|
||||
{
|
||||
@@ -52,9 +52,9 @@ namespace VMAP
|
||||
}
|
||||
}
|
||||
|
||||
void VMapManager2::InitializeThreadUnsafe(const std::vector<uint32>& mapIds)
|
||||
void VMapMgr2::InitializeThreadUnsafe(const std::vector<uint32>& mapIds)
|
||||
{
|
||||
// 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 VMapMgr2 lifetime
|
||||
for (const uint32& mapId : mapIds)
|
||||
{
|
||||
iInstanceMapTrees.emplace(mapId, nullptr);
|
||||
@@ -63,7 +63,7 @@ namespace VMAP
|
||||
thread_safe_environment = false;
|
||||
}
|
||||
|
||||
Vector3 VMapManager2::convertPositionToInternalRep(float x, float y, float z) const
|
||||
Vector3 VMapMgr2::convertPositionToInternalRep(float x, float y, float z) const
|
||||
{
|
||||
Vector3 pos;
|
||||
const float mid = 0.5f * MAX_NUMBER_OF_GRIDS * SIZE_OF_GRIDS;
|
||||
@@ -74,7 +74,7 @@ namespace VMAP
|
||||
return pos;
|
||||
}
|
||||
|
||||
InstanceTreeMap::const_iterator VMapManager2::GetMapTree(uint32 mapId) const
|
||||
InstanceTreeMap::const_iterator VMapMgr2::GetMapTree(uint32 mapId) const
|
||||
{
|
||||
// return the iterator if found or end() if not found/NULL
|
||||
InstanceTreeMap::const_iterator itr = iInstanceMapTrees.find(mapId);
|
||||
@@ -87,7 +87,7 @@ namespace VMAP
|
||||
}
|
||||
|
||||
// move to MapTree too?
|
||||
std::string VMapManager2::getMapFileName(unsigned int mapId)
|
||||
std::string VMapMgr2::getMapFileName(unsigned int mapId)
|
||||
{
|
||||
std::stringstream fname;
|
||||
fname.width(3);
|
||||
@@ -96,7 +96,7 @@ namespace VMAP
|
||||
return fname.str();
|
||||
}
|
||||
|
||||
int VMapManager2::loadMap(const char* basePath, unsigned int mapId, int x, int y)
|
||||
int VMapMgr2::loadMap(const char* basePath, unsigned int mapId, int x, int y)
|
||||
{
|
||||
int result = VMAP_LOAD_RESULT_IGNORED;
|
||||
if (isMapLoadingEnabled())
|
||||
@@ -115,7 +115,7 @@ namespace VMAP
|
||||
}
|
||||
|
||||
// load one tile (internal use only)
|
||||
bool VMapManager2::_loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY)
|
||||
bool VMapMgr2::_loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY)
|
||||
{
|
||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||
if (instanceTree == iInstanceMapTrees.end())
|
||||
@@ -125,7 +125,7 @@ namespace VMAP
|
||||
instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, nullptr)).first;
|
||||
}
|
||||
else
|
||||
ASSERT(false, "Invalid mapId %u tile [%u, %u] passed to VMapManager2 after startup in thread unsafe environment",
|
||||
ASSERT(false, "Invalid mapId %u tile [%u, %u] passed to VMapMgr2 after startup in thread unsafe environment",
|
||||
mapId, tileX, tileY);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace VMAP
|
||||
return instanceTree->second->LoadMapTile(tileX, tileY, this);
|
||||
}
|
||||
|
||||
void VMapManager2::unloadMap(unsigned int mapId)
|
||||
void VMapMgr2::unloadMap(unsigned int mapId)
|
||||
{
|
||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||
if (instanceTree != iInstanceMapTrees.end() && instanceTree->second)
|
||||
@@ -158,7 +158,7 @@ namespace VMAP
|
||||
}
|
||||
}
|
||||
|
||||
void VMapManager2::unloadMap(unsigned int mapId, int x, int y)
|
||||
void VMapMgr2::unloadMap(unsigned int mapId, int x, int y)
|
||||
{
|
||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||
if (instanceTree != iInstanceMapTrees.end() && instanceTree->second)
|
||||
@@ -172,7 +172,7 @@ namespace VMAP
|
||||
}
|
||||
}
|
||||
|
||||
bool VMapManager2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2)
|
||||
bool VMapMgr2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2)
|
||||
{
|
||||
#if defined(ENABLE_VMAP_CHECKS)
|
||||
if (!isLineOfSightCalcEnabled() || IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
|
||||
@@ -199,7 +199,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(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist)
|
||||
bool VMapMgr2::GetObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist)
|
||||
{
|
||||
#if defined(ENABLE_VMAP_CHECKS)
|
||||
if (isLineOfSightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
|
||||
@@ -231,7 +231,7 @@ namespace VMAP
|
||||
get height or INVALID_HEIGHT if no height available
|
||||
*/
|
||||
|
||||
float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist)
|
||||
float VMapMgr2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist)
|
||||
{
|
||||
#if defined(ENABLE_VMAP_CHECKS)
|
||||
if (isHeightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_HEIGHT))
|
||||
@@ -254,7 +254,7 @@ namespace VMAP
|
||||
return VMAP_INVALID_HEIGHT_VALUE;
|
||||
}
|
||||
|
||||
bool VMapManager2::GetAreaInfo(uint32 mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
|
||||
bool VMapMgr2::GetAreaInfo(uint32 mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
|
||||
{
|
||||
#if defined(ENABLE_VMAP_CHECKS)
|
||||
if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG))
|
||||
@@ -274,7 +274,7 @@ namespace VMAP
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type, uint32& mogpFlags) const
|
||||
bool VMapMgr2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type, uint32& mogpFlags) const
|
||||
{
|
||||
#if defined(ENABLE_VMAP_CHECKS)
|
||||
if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LIQUIDSTATUS))
|
||||
@@ -306,7 +306,7 @@ namespace VMAP
|
||||
return false;
|
||||
}
|
||||
|
||||
void VMapManager2::GetAreaAndLiquidData(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, AreaAndLiquidData& data) const
|
||||
void VMapMgr2::GetAreaAndLiquidData(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, AreaAndLiquidData& data) const
|
||||
{
|
||||
if (IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LIQUIDSTATUS))
|
||||
{
|
||||
@@ -338,7 +338,7 @@ namespace VMAP
|
||||
}
|
||||
}
|
||||
|
||||
WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename)
|
||||
WorldModel* VMapMgr2::acquireModelInstance(const std::string& basepath, const std::string& filename)
|
||||
{
|
||||
//! Critical section, thread safe access to iLoadedModelFiles
|
||||
std::lock_guard<std::mutex> lock(LoadedModelFilesLock);
|
||||
@@ -349,11 +349,11 @@ namespace VMAP
|
||||
WorldModel* worldmodel = new WorldModel();
|
||||
if (!worldmodel->readFile(basepath + filename + ".vmo"))
|
||||
{
|
||||
LOG_ERROR("maps", "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
|
||||
LOG_ERROR("maps", "VMapMgr2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
|
||||
delete worldmodel;
|
||||
return nullptr;
|
||||
}
|
||||
LOG_DEBUG("maps", "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str());
|
||||
LOG_DEBUG("maps", "VMapMgr2: loading file '%s%s'", basepath.c_str(), filename.c_str());
|
||||
model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first;
|
||||
model->second.setModel(worldmodel);
|
||||
}
|
||||
@@ -361,7 +361,7 @@ namespace VMAP
|
||||
return model->second.getModel();
|
||||
}
|
||||
|
||||
void VMapManager2::releaseModelInstance(const std::string& filename)
|
||||
void VMapMgr2::releaseModelInstance(const std::string& filename)
|
||||
{
|
||||
//! Critical section, thread safe access to iLoadedModelFiles
|
||||
std::lock_guard<std::mutex> lock(LoadedModelFilesLock);
|
||||
@@ -369,23 +369,23 @@ namespace VMAP
|
||||
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
|
||||
if (model == iLoadedModelFiles.end())
|
||||
{
|
||||
LOG_ERROR("maps", "VMapManager2: trying to unload non-loaded file '%s'", filename.c_str());
|
||||
LOG_ERROR("maps", "VMapMgr2: trying to unload non-loaded file '%s'", filename.c_str());
|
||||
return;
|
||||
}
|
||||
if (model->second.decRefCount() == 0)
|
||||
{
|
||||
LOG_DEBUG("maps", "VMapManager2: unloading file '%s'", filename.c_str());
|
||||
LOG_DEBUG("maps", "VMapMgr2: unloading file '%s'", filename.c_str());
|
||||
delete model->second.getModel();
|
||||
iLoadedModelFiles.erase(model);
|
||||
}
|
||||
}
|
||||
|
||||
bool VMapManager2::existsMap(const char* basePath, unsigned int mapId, int x, int y)
|
||||
bool VMapMgr2::existsMap(const char* basePath, unsigned int mapId, int x, int y)
|
||||
{
|
||||
return StaticMapTree::CanLoadMap(std::string(basePath), mapId, x, y);
|
||||
}
|
||||
|
||||
void VMapManager2::GetInstanceMapTree(InstanceTreeMap& instanceMapTree)
|
||||
void VMapMgr2::GetInstanceMapTree(InstanceTreeMap& instanceMapTree)
|
||||
{
|
||||
instanceMapTree = iInstanceMapTrees;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
#define _VMAPMANAGER2_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "IVMapManager.h"
|
||||
#include "IVMapMgr.h"
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
@@ -60,7 +60,7 @@ namespace VMAP
|
||||
VMAP_DISABLE_LIQUIDSTATUS = 0x8
|
||||
};
|
||||
|
||||
class VMapManager2 : public IVMapManager
|
||||
class VMapMgr2 : public IVMapMgr
|
||||
{
|
||||
protected:
|
||||
// Tree to check collision
|
||||
@@ -84,8 +84,8 @@ namespace VMAP
|
||||
[[nodiscard]] G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
|
||||
static std::string getMapFileName(unsigned int mapId);
|
||||
|
||||
VMapManager2();
|
||||
~VMapManager2() override;
|
||||
VMapMgr2();
|
||||
~VMapMgr2() override;
|
||||
|
||||
void InitializeThreadUnsafe(const std::vector<uint32>& mapIds);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "Log.h"
|
||||
#include "ModelInstance.h"
|
||||
#include "VMapDefinitions.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapMgr2.h"
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
@@ -244,7 +244,7 @@ namespace VMAP
|
||||
{
|
||||
basePath.push_back('/');
|
||||
}
|
||||
std::string fullname = basePath + VMapManager2::getMapFileName(mapID);
|
||||
std::string fullname = basePath + VMapMgr2::getMapFileName(mapID);
|
||||
bool success = true;
|
||||
FILE* rf = fopen(fullname.c_str(), "rb");
|
||||
if (!rf)
|
||||
@@ -282,7 +282,7 @@ namespace VMAP
|
||||
|
||||
//=========================================================
|
||||
|
||||
bool StaticMapTree::InitMap(const std::string& fname, VMapManager2* vm)
|
||||
bool StaticMapTree::InitMap(const std::string& fname, VMapMgr2* vm)
|
||||
{
|
||||
//VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : initializing StaticMapTree '%s'", fname.c_str());
|
||||
bool success = false;
|
||||
@@ -335,7 +335,7 @@ namespace VMAP
|
||||
|
||||
//=========================================================
|
||||
|
||||
void StaticMapTree::UnloadMap(VMapManager2* vm)
|
||||
void StaticMapTree::UnloadMap(VMapMgr2* vm)
|
||||
{
|
||||
for (loadedSpawnMap::iterator i = iLoadedSpawns.begin(); i != iLoadedSpawns.end(); ++i)
|
||||
{
|
||||
@@ -351,7 +351,7 @@ namespace VMAP
|
||||
|
||||
//=========================================================
|
||||
|
||||
bool StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm)
|
||||
bool StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapMgr2* vm)
|
||||
{
|
||||
if (!iIsTiled)
|
||||
{
|
||||
@@ -446,7 +446,7 @@ namespace VMAP
|
||||
|
||||
//=========================================================
|
||||
|
||||
void StaticMapTree::UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm)
|
||||
void StaticMapTree::UnloadMapTile(uint32 tileX, uint32 tileY, VMapMgr2* vm)
|
||||
{
|
||||
uint32 tileID = packTileID(tileX, tileY);
|
||||
loadedTileMap::iterator tile = iLoadedTiles.find(tileID);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace VMAP
|
||||
{
|
||||
class ModelInstance;
|
||||
class GroupModel;
|
||||
class VMapManager2;
|
||||
class VMapMgr2;
|
||||
|
||||
struct LocationInfo
|
||||
{
|
||||
@@ -63,10 +63,10 @@ namespace VMAP
|
||||
bool GetAreaInfo(G3D::Vector3& pos, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const;
|
||||
bool GetLocationInfo(const G3D::Vector3& pos, LocationInfo& info) const;
|
||||
|
||||
bool InitMap(const std::string& fname, VMapManager2* vm);
|
||||
void UnloadMap(VMapManager2* vm);
|
||||
bool LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
|
||||
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
|
||||
bool InitMap(const std::string& fname, VMapMgr2* vm);
|
||||
void UnloadMap(VMapMgr2* vm);
|
||||
bool LoadMapTile(uint32 tileX, uint32 tileY, VMapMgr2* vm);
|
||||
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapMgr2* vm);
|
||||
[[nodiscard]] bool isTiled() const { return iIsTiled; }
|
||||
[[nodiscard]] uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
|
||||
void GetModelInstances(ModelInstance*& models, uint32& count);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "Timer.h"
|
||||
#include "VMapDefinitions.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "VMapMgr2.h"
|
||||
#include "WorldModel.h"
|
||||
|
||||
using G3D::Vector3;
|
||||
@@ -92,7 +92,7 @@ GameObjectModel::~GameObjectModel()
|
||||
{
|
||||
if (iModel)
|
||||
{
|
||||
VMAP::VMapFactory::createOrGetVMapManager()->releaseModelInstance(name);
|
||||
VMAP::VMapFactory::createOrGetVMapMgr()->releaseModelInstance(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ bool GameObjectModel::initialize(std::unique_ptr<GameObjectModelOwnerBase> model
|
||||
return false;
|
||||
}
|
||||
|
||||
iModel = VMAP::VMapFactory::createOrGetVMapManager()->acquireModelInstance(dataPath + "vmaps/", it->second.name);
|
||||
iModel = VMAP::VMapFactory::createOrGetVMapMgr()->acquireModelInstance(dataPath + "vmaps/", it->second.name);
|
||||
|
||||
if (!iModel)
|
||||
{
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#include "Dynamic/LinkedList.h"
|
||||
#include "Dynamic/LinkedReference/Reference.h"
|
||||
|
||||
template <class TO, class FROM> class RefManager : public LinkedListHead
|
||||
template <class TO, class FROM> class RefMgr : public LinkedListHead
|
||||
{
|
||||
public:
|
||||
typedef LinkedListHead::Iterator< Reference<TO, FROM>> iterator;
|
||||
RefManager() = default;
|
||||
virtual ~RefManager() { clearReferences(); }
|
||||
RefMgr() = default;
|
||||
virtual ~RefMgr() { clearReferences(); }
|
||||
|
||||
Reference<TO, FROM>* getFirst() { return ((Reference<TO, FROM>*) LinkedListHead::getFirst()); }
|
||||
[[nodiscard]] Reference<TO, FROM> const* getFirst() const { return ((Reference<TO, FROM> const*) LinkedListHead::getFirst()); }
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "Define.h"
|
||||
#include "Dynamic/TypeList.h"
|
||||
#include "GridRefManager.h"
|
||||
#include "GridRefMgr.h"
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
@@ -28,7 +28,7 @@ template<class OBJECT>
|
||||
struct ContainerMapList
|
||||
{
|
||||
//std::map<OBJECT_HANDLE, OBJECT *> _element;
|
||||
GridRefManager<OBJECT> _element;
|
||||
GridRefMgr<OBJECT> _element;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
||||
@@ -35,16 +35,16 @@ typedef WINADVAPI BOOL (WINAPI* CSD_T)(SC_HANDLE, DWORD, LPCVOID);
|
||||
|
||||
bool WinServiceInstall()
|
||||
{
|
||||
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
|
||||
SC_HANDLE serviceControlMgr = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
|
||||
|
||||
if (serviceControlManager)
|
||||
if (serviceControlMgr)
|
||||
{
|
||||
char path[_MAX_PATH + 10];
|
||||
if (GetModuleFileName( 0, path, sizeof(path) / sizeof(path[0]) ) > 0)
|
||||
{
|
||||
SC_HANDLE service;
|
||||
std::strcat(path, " --service");
|
||||
service = CreateService(serviceControlManager,
|
||||
service = CreateService(serviceControlMgr,
|
||||
serviceName, // name of service
|
||||
serviceLongName, // service name to display
|
||||
SERVICE_ALL_ACCESS, // desired access
|
||||
@@ -64,7 +64,7 @@ bool WinServiceInstall()
|
||||
if (!advapi32)
|
||||
{
|
||||
CloseServiceHandle(service);
|
||||
CloseServiceHandle(serviceControlManager);
|
||||
CloseServiceHandle(serviceControlMgr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ bool WinServiceInstall()
|
||||
if (!ChangeService_Config2)
|
||||
{
|
||||
CloseServiceHandle(service);
|
||||
CloseServiceHandle(serviceControlManager);
|
||||
CloseServiceHandle(serviceControlMgr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -99,18 +99,18 @@ bool WinServiceInstall()
|
||||
CloseServiceHandle(service);
|
||||
}
|
||||
}
|
||||
CloseServiceHandle(serviceControlManager);
|
||||
CloseServiceHandle(serviceControlMgr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WinServiceUninstall()
|
||||
{
|
||||
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
|
||||
SC_HANDLE serviceControlMgr = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
|
||||
|
||||
if (serviceControlManager)
|
||||
if (serviceControlMgr)
|
||||
{
|
||||
SC_HANDLE service = OpenService(serviceControlManager,
|
||||
SC_HANDLE service = OpenService(serviceControlMgr,
|
||||
serviceName, SERVICE_QUERY_STATUS | DELETE);
|
||||
if (service)
|
||||
{
|
||||
@@ -125,7 +125,7 @@ bool WinServiceUninstall()
|
||||
CloseServiceHandle(service);
|
||||
}
|
||||
|
||||
CloseServiceHandle(serviceControlManager);
|
||||
CloseServiceHandle(serviceControlMgr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user