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 ())
0 commit comments