From c94c6ab72cf5b2e665cd1f5cd17eb790262e0dd2 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 26 Jan 2019 11:29:10 +0100 Subject: [PATCH] Core/Maps: make sure that the grid of the terrain map's parent is loaded when entering terrainswaped zones. This fixes loading vmaps and mmaps for terrain swapped maps --- src/server/game/Maps/Map.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 22c19d7b90e..0042cd0fc3a 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2430,8 +2430,12 @@ GridMap* Map::GetGrid(uint32 mapId, float x, float y) GridMap* grid = GridMaps[gx][gy]; auto childMapItr = std::find_if(m_childTerrainMaps->begin(), m_childTerrainMaps->end(), [mapId](Map* childTerrainMap) { return childTerrainMap->GetId() == mapId; }); - if (childMapItr != m_childTerrainMaps->end() && (*childMapItr)->GridMaps[gx][gy] && (*childMapItr)->GridMaps[gx][gy]->fileExists()) - grid = (*childMapItr)->GridMaps[gx][gy]; + if (childMapItr != m_childTerrainMaps->end()) + { + (*childMapItr)->EnsureGridCreated(GridCoord((MAX_NUMBER_OF_GRIDS - 1) - gx, (MAX_NUMBER_OF_GRIDS - 1) - gy)); + if ((*childMapItr)->GridMaps[gx][gy]->fileExists()) + grid = (*childMapItr)->GridMaps[gx][gy]; + } return grid; }