From eba31dea27b7fdc4a49c024898ef3a01bcbc7295 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 24 May 2020 22:34:25 +0200 Subject: Core/Maps: Improvements to terrain swap handling * Fixed memory leak when unloading grids * Handle child maps being entered * Allow chaining more child maps (Draenor -> Tanaan Jungle -> Tanaan Jungle - No Hubs Phase) --- src/common/Collision/Maps/MapTree.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/common/Collision/Maps/MapTree.cpp') diff --git a/src/common/Collision/Maps/MapTree.cpp b/src/common/Collision/Maps/MapTree.cpp index d6d866be406..a9ed75414c8 100644 --- a/src/common/Collision/Maps/MapTree.cpp +++ b/src/common/Collision/Maps/MapTree.cpp @@ -243,10 +243,14 @@ namespace VMAP if (!result.File) { int32 parentMapId = vm->getParentMapId(mapID); - if (parentMapId != -1) + while (parentMapId != -1) { result.Name = basePath + getTileFileName(parentMapId, tileX, tileY); result.File = fopen(result.Name.c_str(), "rb"); + if (result.File) + break; + + parentMapId = vm->getParentMapId(uint32(parentMapId)); } } -- cgit v1.2.3