Fix #15096: Crash placing entrance near corner in scenario editor

This commit is contained in:
ζeh Matt 2021-07-27 13:02:34 +03:00 committed by GitHub
parent e9eb1b8304
commit 13aee659f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -1,5 +1,6 @@
0.3.4.1+ (in development)
------------------------------------------------------------------------
- Fix: [#15096] Crash when placing entrances in the scenario editor near the map corner.
0.3.4.1 (2021-07-25)
------------------------------------------------------------------------

View File

@ -1412,7 +1412,7 @@ static int32_t footpath_is_connected_to_map_edge_helper(CoordsXYZ footpathPos, i
edges = tileElement->AsPath()->GetEdges();
currentTile.direction = direction_reverse(currentTile.direction);
if (!(flags & FOOTPATH_CONNECTED_MAP_EDGE_IGNORE_NO_ENTRY))
if (!tileElement->IsLastForTile() && !(flags & FOOTPATH_CONNECTED_MAP_EDGE_IGNORE_NO_ENTRY))
{
int elementIndex = 1;
// Loop over all elements and cull appropriate edges
@ -1422,12 +1422,10 @@ static int32_t footpath_is_connected_to_map_edge_helper(CoordsXYZ footpathPos, i
break;
if (tileElement[elementIndex].GetType() != TILE_ELEMENT_TYPE_BANNER)
{
++elementIndex;
continue;
}
edges &= tileElement[elementIndex].AsBanner()->GetAllowedEdges();
++elementIndex;
} while (!tileElement[elementIndex].IsLastForTile());
} while (!tileElement[elementIndex++].IsLastForTile());
}
// Exclude the direction we came from