Skip to content

Commit 03e2aa6

Browse files
committed
Core/Vmaps: Rename VMapManager2 to VMapManager
1 parent 96b5679 commit 03e2aa6

File tree

22 files changed

+90
-90
lines changed

22 files changed

+90
-90
lines changed

src/common/Collision/DynamicTree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "RegularGrid.h"
2424
#include "Timer.h"
2525
#include "VMapFactory.h"
26-
#include "VMapManager2.h"
26+
#include "VMapManager.h"
2727
#include "WorldModel.h"
2828
#include <G3D/AABox.h>
2929
#include <G3D/Ray.h>

src/common/Collision/Management/VMapFactory.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
*/
1717

1818
#include "VMapFactory.h"
19-
#include "VMapManager2.h"
19+
#include "VMapManager.h"
2020

2121
namespace VMAP
2222
{
23-
VMapManager2* gVMapManager = nullptr;
23+
VMapManager* gVMapManager = nullptr;
2424

2525
//===============================================
2626
// just return the instance
27-
VMapManager2* VMapFactory::createOrGetVMapManager()
27+
VMapManager* VMapFactory::createOrGetVMapManager()
2828
{
2929
if (gVMapManager == nullptr)
30-
gVMapManager= new VMapManager2();
30+
gVMapManager= new VMapManager();
3131
return gVMapManager;
3232
}
3333

src/common/Collision/Management/VMapFactory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ This is the access point to the VMapManager.
2626

2727
namespace VMAP
2828
{
29-
class VMapManager2;
29+
class VMapManager;
3030

3131
class TC_COMMON_API VMapFactory
3232
{
3333
public:
34-
static VMapManager2* createOrGetVMapManager();
34+
static VMapManager* createOrGetVMapManager();
3535
static void clear();
3636
};
3737

src/common/Collision/Management/VMapManager2.cpp renamed to src/common/Collision/Management/VMapManager.cpp

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
#include "VMapManager2.h"
18+
#include "VMapManager.h"
1919
#include "Errors.h"
2020
#include "Log.h"
2121
#include "MapTree.h"
@@ -29,7 +29,7 @@ namespace VMAP
2929
class ManagedModel
3030
{
3131
public:
32-
explicit ManagedModel(VMapManager2& mgr, std::string const& name) : _mgr(mgr), _name(name) { }
32+
explicit ManagedModel(VMapManager& mgr, std::string const& name) : _mgr(mgr), _name(name) { }
3333

3434
ManagedModel(ManagedModel const&) = delete;
3535
ManagedModel(ManagedModel&&) = delete;
@@ -45,8 +45,8 @@ namespace VMAP
4545
WorldModel Model;
4646

4747
private:
48-
VMapManager2& _mgr;
49-
std::string const& _name; // valid only while model is held in VMapManager2::iLoadedModelFiles
48+
VMapManager& _mgr;
49+
std::string const& _name; // valid only while model is held in VMapManager::iLoadedModelFiles
5050
};
5151

5252
bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len)
@@ -55,7 +55,7 @@ namespace VMAP
5555
return memcmp(dest, compare, len) == 0;
5656
}
5757

58-
VMapManager2::VMapManager2() :
58+
VMapManager::VMapManager() :
5959
iEnableLineOfSightCalc(true),
6060
iEnableHeightCalc(true),
6161
thread_safe_environment(true),
@@ -64,9 +64,9 @@ namespace VMAP
6464
{
6565
}
6666

67-
VMapManager2::~VMapManager2() = default;
67+
VMapManager::~VMapManager() = default;
6868

69-
InstanceTreeMap::const_iterator VMapManager2::GetMapTree(uint32 mapId) const
69+
InstanceTreeMap::const_iterator VMapManager::GetMapTree(uint32 mapId) const
7070
{
7171
// return the iterator if found or end() if not found/NULL
7272
auto itr = iInstanceMapTrees.find(mapId);
@@ -76,9 +76,9 @@ namespace VMAP
7676
return itr;
7777
}
7878

79-
void VMapManager2::InitializeThreadUnsafe(std::unordered_map<uint32, std::vector<uint32>> const& mapData)
79+
void VMapManager::InitializeThreadUnsafe(std::unordered_map<uint32, std::vector<uint32>> const& mapData)
8080
{
81-
// the caller must pass the list of all mapIds that will be used in the VMapManager2 lifetime
81+
// the caller must pass the list of all mapIds that will be used in the VMapManager lifetime
8282
for (auto const& [mapId, childMapIds] : mapData)
8383
{
8484
iInstanceMapTrees[mapId] = nullptr;
@@ -89,7 +89,7 @@ namespace VMAP
8989
thread_safe_environment = false;
9090
}
9191

92-
void VMapManager2::InitializeThreadUnsafe(uint32 mapId, int32 parentMapId)
92+
void VMapManager::InitializeThreadUnsafe(uint32 mapId, int32 parentMapId)
9393
{
9494
iInstanceMapTrees[mapId] = nullptr;
9595
if (parentMapId >= 0)
@@ -107,17 +107,17 @@ namespace VMAP
107107
return pos;
108108
}
109109

110-
std::string VMapManager2::getMapFileName(uint32 mapId)
110+
std::string VMapManager::getMapFileName(uint32 mapId)
111111
{
112112
return Trinity::StringFormat("{:04}/{:04}.vmtree", mapId, mapId);
113113
}
114114

115-
std::string VMapManager2::getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY, std::string_view extension)
115+
std::string VMapManager::getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY, std::string_view extension)
116116
{
117117
return Trinity::StringFormat("{:04}/{:04}_{:02}_{:02}.{}", mapID, mapID, tileY, tileX, extension);
118118
}
119119

120-
LoadResult VMapManager2::loadMap(std::string const& basePath, uint32 mapId, uint32 x, uint32 y)
120+
LoadResult VMapManager::loadMap(std::string const& basePath, uint32 mapId, uint32 x, uint32 y)
121121
{
122122
if (!isMapLoadingEnabled())
123123
return LoadResult::DisabledInConfig;
@@ -128,7 +128,7 @@ namespace VMAP
128128
if (thread_safe_environment)
129129
instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, nullptr)).first;
130130
else
131-
ABORT_MSG("Invalid mapId %u tile [%u, %u] passed to VMapManager2 after startup in thread unsafe environment",
131+
ABORT_MSG("Invalid mapId %u tile [%u, %u] passed to VMapManager after startup in thread unsafe environment",
132132
mapId, x, y);
133133
}
134134

@@ -146,7 +146,7 @@ namespace VMAP
146146
return instanceTree->second->LoadMapTile(x, y, this);
147147
}
148148

149-
void VMapManager2::unloadMap(uint32 mapId, uint32 x, uint32 y)
149+
void VMapManager::unloadMap(uint32 mapId, uint32 x, uint32 y)
150150
{
151151
auto instanceTree = iInstanceMapTrees.find(mapId);
152152
if (instanceTree != iInstanceMapTrees.end() && instanceTree->second)
@@ -157,7 +157,7 @@ namespace VMAP
157157
}
158158
}
159159

160-
void VMapManager2::unloadMap(uint32 mapId)
160+
void VMapManager::unloadMap(uint32 mapId)
161161
{
162162
auto instanceTree = iInstanceMapTrees.find(mapId);
163163
if (instanceTree != iInstanceMapTrees.end() && instanceTree->second)
@@ -168,7 +168,7 @@ namespace VMAP
168168
}
169169
}
170170

171-
bool VMapManager2::isInLineOfSight(uint32 mapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags)
171+
bool VMapManager::isInLineOfSight(uint32 mapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags)
172172
{
173173
if (!isLineOfSightCalcEnabled() || IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
174174
return true;
@@ -189,7 +189,7 @@ namespace VMAP
189189
get the hit position and return true if we hit something
190190
otherwise the result pos will be the dest pos
191191
*/
192-
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)
192+
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)
193193
{
194194
if (isLineOfSightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
195195
{
@@ -219,7 +219,7 @@ namespace VMAP
219219
get height or INVALID_HEIGHT if no height available
220220
*/
221221

222-
float VMapManager2::getHeight(uint32 mapId, float x, float y, float z, float maxSearchDist)
222+
float VMapManager::getHeight(uint32 mapId, float x, float y, float z, float maxSearchDist)
223223
{
224224
if (isHeightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_HEIGHT))
225225
{
@@ -238,7 +238,7 @@ namespace VMAP
238238
return VMAP_INVALID_HEIGHT_VALUE;
239239
}
240240

241-
bool VMapManager2::getAreaAndLiquidData(uint32 mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const
241+
bool VMapManager::getAreaAndLiquidData(uint32 mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const
242242
{
243243
InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId);
244244
if (instanceTree != iInstanceMapTrees.end())
@@ -267,7 +267,7 @@ namespace VMAP
267267
return false;
268268
}
269269

270-
std::shared_ptr<WorldModel> VMapManager2::acquireModelInstance(std::string const& basepath, std::string const& filename)
270+
std::shared_ptr<WorldModel> VMapManager::acquireModelInstance(std::string const& basepath, std::string const& filename)
271271
{
272272
std::shared_ptr<ManagedModel> worldmodel; // this is intentionally declared before lock so that it is destroyed after it to prevent deadlocks in releaseModelInstance
273273

@@ -282,34 +282,34 @@ namespace VMAP
282282
worldmodel = std::make_shared<ManagedModel>(*this, key);
283283
if (!worldmodel->Model.readFile(basepath + filename + ".vmo"))
284284
{
285-
TC_LOG_ERROR("misc", "VMapManager2: could not load '{}{}.vmo'", basepath, filename);
285+
TC_LOG_ERROR("misc", "VMapManager: could not load '{}{}.vmo'", basepath, filename);
286286
return nullptr;
287287
}
288-
TC_LOG_DEBUG("maps", "VMapManager2: loading file '{}{}'", basepath, filename);
288+
TC_LOG_DEBUG("maps", "VMapManager: loading file '{}{}'", basepath, filename);
289289

290290
model = worldmodel;
291291

292292
return std::shared_ptr<WorldModel>(worldmodel, &worldmodel->Model);
293293
}
294294

295-
void VMapManager2::releaseModelInstance(std::string const& filename)
295+
void VMapManager::releaseModelInstance(std::string const& filename)
296296
{
297297
//! Critical section, thread safe access to iLoadedModelFiles
298298
std::lock_guard lock(LoadedModelFilesLock);
299299

300-
TC_LOG_DEBUG("maps", "VMapManager2: unloading file '{}'", filename);
300+
TC_LOG_DEBUG("maps", "VMapManager: unloading file '{}'", filename);
301301

302302
std::size_t erased = iLoadedModelFiles.erase(filename);
303303
if (!erased)
304-
TC_LOG_ERROR("misc", "VMapManager2: trying to unload non-loaded file '{}'", filename);
304+
TC_LOG_ERROR("misc", "VMapManager: trying to unload non-loaded file '{}'", filename);
305305
}
306306

307-
LoadResult VMapManager2::existsMap(std::string const& basePath, uint32 mapId, uint32 x, uint32 y)
307+
LoadResult VMapManager::existsMap(std::string const& basePath, uint32 mapId, uint32 x, uint32 y)
308308
{
309309
return StaticMapTree::CanLoadMap(basePath, mapId, x, y, this);
310310
}
311311

312-
std::span<ModelInstance const> VMapManager2::getModelsOnMap(uint32 mapId) const
312+
std::span<ModelInstance const> VMapManager::getModelsOnMap(uint32 mapId) const
313313
{
314314
InstanceTreeMap::const_iterator mapTree = GetMapTree(mapId);
315315
if (mapTree != iInstanceMapTrees.end())
@@ -318,7 +318,7 @@ namespace VMAP
318318
return {};
319319
}
320320

321-
int32 VMapManager2::getParentMapId(uint32 mapId) const
321+
int32 VMapManager::getParentMapId(uint32 mapId) const
322322
{
323323
auto itr = iParentMapData.find(mapId);
324324
if (itr != iParentMapData.end())

src/common/Collision/Management/VMapManager2.h renamed to src/common/Collision/Management/VMapManager.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ namespace VMAP
9696
Optional<LiquidInfo> liquidInfo;
9797
};
9898

99-
class TC_COMMON_API VMapManager2
99+
class TC_COMMON_API VMapManager
100100
{
101101
protected:
102102
bool iEnableLineOfSightCalc;
@@ -116,15 +116,15 @@ namespace VMAP
116116
static std::string getMapFileName(uint32 mapId);
117117
static std::string getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY, std::string_view extension);
118118

119-
VMapManager2();
119+
VMapManager();
120120

121-
VMapManager2(VMapManager2 const&) = delete;
122-
VMapManager2(VMapManager2&&) = delete;
121+
VMapManager(VMapManager const&) = delete;
122+
VMapManager(VMapManager&&) = delete;
123123

124-
VMapManager2& operator=(VMapManager2 const&) = delete;
125-
VMapManager2& operator=(VMapManager2&&) = delete;
124+
VMapManager& operator=(VMapManager const&) = delete;
125+
VMapManager& operator=(VMapManager&&) = delete;
126126

127-
~VMapManager2();
127+
~VMapManager();
128128

129129
void InitializeThreadUnsafe(std::unordered_map<uint32, std::vector<uint32>> const& mapData);
130130
void InitializeThreadUnsafe(uint32 mapId, int32 parentMapId);

src/common/Collision/Maps/MapTree.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "Metric.h"
2323
#include "ModelInstance.h"
2424
#include "VMapDefinitions.h"
25-
#include "VMapManager2.h"
25+
#include "VMapManager.h"
2626
#include "WorldModel.h"
2727
#include <limits>
2828
#include <string>
@@ -199,19 +199,19 @@ namespace VMAP
199199
explicit operator bool() const { return TileFile && SpawnIndicesFile; }
200200
};
201201

202-
TileFileOpenResult OpenMapTileFile(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager2* vm)
202+
TileFileOpenResult OpenMapTileFile(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager* vm)
203203
{
204204
TileFileOpenResult result;
205-
result.Name = basePath + VMapManager2::getTileFileName(mapID, tileX, tileY, "vmtile");
205+
result.Name = basePath + VMapManager::getTileFileName(mapID, tileX, tileY, "vmtile");
206206
result.TileFile.reset(fopen(result.Name.c_str(), "rb"));
207-
result.SpawnIndicesFile.reset(fopen((basePath + VMapManager2::getTileFileName(mapID, tileX, tileY, "vmtileidx")).c_str(), "rb"));
207+
result.SpawnIndicesFile.reset(fopen((basePath + VMapManager::getTileFileName(mapID, tileX, tileY, "vmtileidx")).c_str(), "rb"));
208208
result.UsedMapId = mapID;
209209
if (!result.TileFile)
210210
{
211211
int32 parentMapId = vm->getParentMapId(mapID);
212212
while (parentMapId != -1)
213213
{
214-
result.Name = basePath + VMapManager2::getTileFileName(parentMapId, tileX, tileY, "vmtile");
214+
result.Name = basePath + VMapManager::getTileFileName(parentMapId, tileX, tileY, "vmtile");
215215
result.TileFile.reset(fopen(result.Name.c_str(), "rb"));
216216
result.UsedMapId = parentMapId;
217217
if (result.TileFile)
@@ -225,13 +225,13 @@ namespace VMAP
225225
}
226226

227227
//=========================================================
228-
LoadResult StaticMapTree::CanLoadMap(std::string const& vmapPath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager2* vm)
228+
LoadResult StaticMapTree::CanLoadMap(std::string const& vmapPath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager* vm)
229229
{
230230
std::string basePath = vmapPath;
231231
if (!basePath.empty() && basePath.back() != '/' && basePath.back() != '\\')
232232
basePath.push_back('/');
233233

234-
std::string fullname = basePath + VMapManager2::getMapFileName(mapID);
234+
std::string fullname = basePath + VMapManager::getMapFileName(mapID);
235235

236236
auto rf = Trinity::make_unique_ptr_with_deleter<&::fclose>(fopen(fullname.c_str(), "rb"));
237237
if (!rf)
@@ -285,7 +285,7 @@ namespace VMAP
285285

286286
//=========================================================
287287

288-
LoadResult StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm)
288+
LoadResult StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapManager* vm)
289289
{
290290
if (iTreeValues.empty())
291291
{
@@ -369,7 +369,7 @@ namespace VMAP
369369

370370
//=========================================================
371371

372-
void StaticMapTree::UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm)
372+
void StaticMapTree::UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager* vm)
373373
{
374374
uint32 tileID = packTileID(tileX, tileY);
375375
loadedTileMap::iterator tile = iLoadedTiles.find(tileID);

src/common/Collision/Maps/MapTree.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace VMAP
2727
{
2828
class ModelInstance;
2929
class GroupModel;
30-
class VMapManager2;
30+
class VMapManager;
3131
enum class LoadResult : uint8;
3232
enum class ModelIgnoreFlags : uint32;
3333

@@ -66,7 +66,7 @@ namespace VMAP
6666
public:
6767
static uint32 packTileID(uint32 tileX, uint32 tileY) { return tileX << 16 | tileY; }
6868
static void unpackTileID(uint32 ID, uint32& tileX, uint32& tileY) { tileX = ID >> 16; tileY = ID & 0xFF; }
69-
static LoadResult CanLoadMap(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager2* vm);
69+
static LoadResult CanLoadMap(std::string const& basePath, uint32 mapID, uint32 tileX, uint32 tileY, VMapManager* vm);
7070

7171
StaticMapTree(uint32 mapID, std::string const& basePath);
7272
~StaticMapTree();
@@ -78,8 +78,8 @@ namespace VMAP
7878

7979
LoadResult InitMap(std::string const& fname);
8080
void UnloadMap();
81-
LoadResult LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
82-
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
81+
LoadResult LoadMapTile(uint32 tileX, uint32 tileY, VMapManager* vm);
82+
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager* vm);
8383
uint32 numLoadedTiles() const { return uint32(iLoadedTiles.size()); }
8484
std::span<ModelInstance const> getModelInstances() const;
8585

src/common/Collision/Models/GameObjectModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
#include "VMapFactory.h"
19-
#include "VMapManager2.h"
19+
#include "VMapManager.h"
2020
#include "VMapDefinitions.h"
2121
#include "WorldModel.h"
2222
#include "GameObjectModel.h"

0 commit comments

Comments
 (0)