diff options
Diffstat (limited to 'src/common/Collision/Management/VMapManager2.cpp')
-rw-r--r-- | src/common/Collision/Management/VMapManager2.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/common/Collision/Management/VMapManager2.cpp b/src/common/Collision/Management/VMapManager2.cpp index 88494d0a0c7..ed4e5535250 100644 --- a/src/common/Collision/Management/VMapManager2.cpp +++ b/src/common/Collision/Management/VMapManager2.cpp @@ -104,14 +104,21 @@ namespace VMAP int result = VMAP_LOAD_RESULT_IGNORED; if (isMapLoadingEnabled()) { - if (loadSingleMap(mapId, basePath, x, y)) + LoadResult parentLoadResult = loadSingleMap(mapId, basePath, x, y); + if (parentLoadResult == LoadResult::Success || parentLoadResult == LoadResult::FileNotFound) { - result = VMAP_LOAD_RESULT_OK; + if (parentLoadResult == LoadResult::Success) + result = VMAP_LOAD_RESULT_OK; + // else VMAP_LOAD_RESULT_IGNORED + auto childMaps = iChildMapData.find(mapId); if (childMaps != iChildMapData.end()) for (uint32 childMapId : childMaps->second) - if (!loadSingleMap(childMapId, basePath, x, y)) + { + LoadResult childLoadResult = loadSingleMap(childMapId, basePath, x, y); + if (childLoadResult != LoadResult::Success && childLoadResult != LoadResult::FileNotFound) result = VMAP_LOAD_RESULT_ERROR; + } } else result = VMAP_LOAD_RESULT_ERROR; @@ -121,7 +128,7 @@ namespace VMAP } // load one tile (internal use only) - bool VMapManager2::loadSingleMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY) + LoadResult VMapManager2::loadSingleMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY) { auto instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree == iInstanceMapTrees.end()) @@ -137,10 +144,11 @@ namespace VMAP { std::string mapFileName = getMapFileName(mapId); StaticMapTree* newTree = new StaticMapTree(mapId, basePath); - if (!newTree->InitMap(mapFileName)) + LoadResult treeInitResult = newTree->InitMap(mapFileName); + if (treeInitResult != LoadResult::Success) { delete newTree; - return false; + return treeInitResult; } instanceTree->second = newTree; } |