mirror of https://github.com/OpenRCT2/OpenRCT2.git
Unblock tiles when vehicles are removed from ride
This commit is contained in:
parent
d1d9f0a86a
commit
b4d3806614
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue