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

This commit is contained in:
Ovahlord
2019-01-26 11:29:10 +01:00
parent c66c472023
commit c94c6ab72c

View File

@@ -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;
}