From 6b41c3d3274653605b42f1144f554fe43eee344e Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 2 Oct 2025 13:43:45 +0200 Subject: Core/MMaps: Improve mmap debugging experience for terrain swap maps * Output terrain map id in `.mmap loc` command * Suppress file not found errors for terrain swap maps * Fix generating single tiles for terrain swap maps (--tile argument) --- src/server/game/Maps/TerrainMgr.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/server/game/Maps/TerrainMgr.cpp') diff --git a/src/server/game/Maps/TerrainMgr.cpp b/src/server/game/Maps/TerrainMgr.cpp index a18373dc248..2e6d8e184b9 100644 --- a/src/server/game/Maps/TerrainMgr.cpp +++ b/src/server/game/Maps/TerrainMgr.cpp @@ -239,12 +239,21 @@ void TerrainInfo::LoadMMap(int32 gx, int32 gy) if (!DisableMgr::IsPathfindingEnabled(GetId())) return; - bool mmapLoadResult = MMAP::MMapFactory::createOrGetMMapManager()->loadMap(sWorld->GetDataPath(), GetId(), gx, gy); - - if (mmapLoadResult) - TC_LOG_DEBUG("mmaps.tiles", "MMAP loaded name:{}, id:{}, x:{}, y:{} (mmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy); - else - TC_LOG_WARN("mmaps.tiles", "Could not load MMAP name:{}, id:{}, x:{}, y:{} (mmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy); + switch (MMAP::LoadResult mmapLoadResult = MMAP::MMapFactory::createOrGetMMapManager()->loadMap(sWorld->GetDataPath(), GetId(), gx, gy)) + { + case MMAP::LoadResult::Success: + TC_LOG_DEBUG("mmaps.tiles", "MMAP loaded name:{}, id:{}, x:{}, y:{} (mmap rep.: x:{}, y:{})", GetMapName(), GetId(), gx, gy, gx, gy); + break; + case MMAP::LoadResult::AlreadyLoaded: + break; + case MMAP::LoadResult::FileNotFound: + if (_parentTerrain) + break; // don't log tile not found errors for child maps + [[fallthrough]]; + default: + TC_LOG_WARN("mmaps.tiles", "Could not load MMAP name:{}, id:{}, x:{}, y:{} (mmap rep.: x:{}, y:{}) result: {}", GetMapName(), GetId(), gx, gy, gx, gy, AsUnderlyingType(mmapLoadResult)); + break; + } } void TerrainInfo::UnloadMap(int32 gx, int32 gy) -- cgit v1.2.3