diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index b584d4cc32..8373041cbf 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -1097,6 +1097,7 @@ void ride_clear_for_construction(sint32 rideIndex) ride_remove_cable_lift(ride); ride_remove_vehicles(ride); + ride_clear_blocked_tiles(rideIndex); w = window_find_by_number(WC_RIDE, rideIndex); if (w != nullptr) @@ -1185,6 +1186,34 @@ void ride_remove_peeps(sint32 rideIndex) ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN; } +void ride_clear_blocked_tiles(sint32 rideIndex) +{ + for (sint32 y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) + { + for (sint32 x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) + { + auto element = map_get_first_element_at(x, y); + if (element != nullptr) + { + do + { + if (element->GetType() == TILE_ELEMENT_TYPE_TRACK && + element->properties.track.ride_index == rideIndex) + { + // Unblock footpath element that is at same position + auto footpathElement = map_get_footpath_element(x, y, element->base_height); + if (footpathElement != nullptr) + { + footpathElement->flags &= ~TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE; + } + } + } + while (!(element++)->IsLastForTile()); + } + } + } +} + /** * Gets the origin track element (sequence 0). Seems to do more than that though and even invalidates track. * rct2: 0x006C683D diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index 84f16af2d9..712c92fc96 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -972,6 +972,7 @@ void ride_construct_new(ride_list_item listItem); void ride_construct(sint32 rideIndex); sint32 ride_modify(CoordsXYE *input); void ride_remove_peeps(sint32 rideIndex); +void ride_clear_blocked_tiles(sint32 rideIndex); void ride_get_status(sint32 rideIndex, rct_string_id *formatSecondary, sint32 *argument); rct_peep *ride_get_assigned_mechanic(Ride *ride); sint32 ride_get_total_length(Ride *ride);