Index: source/simulation2/components/CCmpPathfinder.cpp =================================================================== --- source/simulation2/components/CCmpPathfinder.cpp +++ source/simulation2/components/CCmpPathfinder.cpp @@ -552,6 +552,16 @@ SAFE_DELETE(m_TerrainOnlyGrid); m_TerrainOnlyGrid = new Grid(m_MapSize * Pathfinding::NAVCELLS_PER_TILE, m_MapSize * Pathfinding::NAVCELLS_PER_TILE); + + // If this update comes from a map resizing, we must reinitialize the other grids as well + if (!m_TerrainOnlyGrid->compare_sizes(m_Grid)) + { + SAFE_DELETE(m_Grid); + m_Grid = new Grid(m_MapSize * Pathfinding::NAVCELLS_PER_TILE, m_MapSize * Pathfinding::NAVCELLS_PER_TILE); + + m_DirtinessInformation = { true, true, Grid(m_MapSize * Pathfinding::NAVCELLS_PER_TILE, m_MapSize * Pathfinding::NAVCELLS_PER_TILE) }; + m_AIPathfinderDirtinessInformation = m_DirtinessInformation; + } } Grid shoreGrid = ComputeShoreGrid(); Index: source/simulation2/helpers/Grid.h =================================================================== --- source/simulation2/helpers/Grid.h +++ source/simulation2/helpers/Grid.h @@ -165,7 +165,7 @@ template bool compare_sizes(const Grid* g) const { - return m_W == g->m_W && m_H == g->m_H; + return g && m_W == g->m_W && m_H == g->m_H; } u16 m_W, m_H;