aboutsummaryrefslogtreecommitdiff
path: root/src/common/mmaps_common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/mmaps_common')
-rw-r--r--src/common/mmaps_common/Management/MMapManager.cpp22
-rw-r--r--src/common/mmaps_common/Management/MMapManager.h5
2 files changed, 24 insertions, 3 deletions
diff --git a/src/common/mmaps_common/Management/MMapManager.cpp b/src/common/mmaps_common/Management/MMapManager.cpp
index d6d181bd9d4..a45c1ee5fbb 100644
--- a/src/common/mmaps_common/Management/MMapManager.cpp
+++ b/src/common/mmaps_common/Management/MMapManager.cpp
@@ -50,8 +50,21 @@ namespace MMAP
// we have to use single dtNavMeshQuery for every instance, since those are not thread safe
NavMeshQuerySet navMeshQueries; // instanceId to query
- static uint32 GetInstanceIdForMeshLookup([[maybe_unused]] uint32 mapId, [[maybe_unused]] uint32 instanceId)
+ static uint32 GetInstanceIdForMeshLookup(uint32 mapId, uint32 instanceId)
{
+ switch (mapId)
+ {
+ case 0: case 1: case 571: case 603: case 607: case 609: case 616: case 628: case 631: case 644: case 649: case 720:
+ case 732: case 754: case 755: case 861: case 938: case 940: case 962: case 967: case 1064: case 1076: case 1098:
+ case 1122: case 1126: case 1182: case 1205: case 1220: case 1265: case 1492: case 1523: case 1530: case 1579: case 1676:
+ case 1704: case 1705: case 1706: case 1707: case 1734: case 1756: case 1943: case 2076: case 2118: case 2160: case 2161:
+ case 2187: case 2212: case 2235: case 2237: case 2264: case 2450: case 2512: case 2586: case 2601: case 2654: case 2657:
+ case 2660: case 2669: case 2819: case 2828:
+ return instanceId;
+ default:
+ break;
+ }
+
// for maps that won't have dynamic mesh, return 0 to reuse the same mesh across all instances
return 0;
}
@@ -103,6 +116,11 @@ namespace MMAP
return itr;
}
+ bool MMapManager::isRebuildingTilesEnabledOnMap(uint32 mapId)
+ {
+ return MMapData::GetInstanceIdForMeshLookup(mapId, 1) != 0;
+ }
+
LoadResult MMapManager::loadMapData(std::string_view basePath, uint32 mapId, uint32 instanceId)
{
// we already have this map loaded?
@@ -441,7 +459,7 @@ namespace MMAP
TC_LOG_DEBUG("maps", "MMAP:unloadMapInstance: Unloaded mapId {:04} instanceId {}", instanceMapId, instanceId);
}
- dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId, uint32 instanceId)
+ dtNavMesh* MMapManager::GetNavMesh(uint32 mapId, uint32 instanceId)
{
MMapDataSet::const_iterator itr = GetMMapData(mapId);
if (itr == loadedMMaps.end())
diff --git a/src/common/mmaps_common/Management/MMapManager.h b/src/common/mmaps_common/Management/MMapManager.h
index b277a3e96da..3d8a86ba2c0 100644
--- a/src/common/mmaps_common/Management/MMapManager.h
+++ b/src/common/mmaps_common/Management/MMapManager.h
@@ -67,10 +67,13 @@ namespace MMAP
// the returned [dtNavMeshQuery const*] is NOT threadsafe
dtNavMeshQuery const* GetNavMeshQuery(uint32 meshMapId, uint32 instanceMapId, uint32 instanceId);
- dtNavMesh const* GetNavMesh(uint32 mapId, uint32 instanceId);
+ dtNavMesh* GetNavMesh(uint32 mapId, uint32 instanceId);
uint32 getLoadedTilesCount() const { return loadedTiles; }
uint32 getLoadedMapsCount() const { return uint32(loadedMMaps.size()); }
+
+ static bool isRebuildingTilesEnabledOnMap(uint32 mapId);
+
private:
LoadResult loadMapData(std::string_view basePath, uint32 mapId, uint32 instanceId);
uint32 packTileID(int32 x, int32 y);