aboutsummaryrefslogtreecommitdiff
path: root/src/common/Collision/Maps/MapTree.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-05-24 22:34:25 +0200
committerShauren <shauren.trinity@gmail.com>2020-05-24 22:34:25 +0200
commiteba31dea27b7fdc4a49c024898ef3a01bcbc7295 (patch)
tree4be401cb2969769c92b571e1b8d04555f633693e /src/common/Collision/Maps/MapTree.cpp
parentebb6f12db811d78a538982cca9b8cc1887fc2527 (diff)
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)
Diffstat (limited to 'src/common/Collision/Maps/MapTree.cpp')
-rw-r--r--src/common/Collision/Maps/MapTree.cpp6
1 files changed, 5 insertions, 1 deletions
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));
}
}