From 7fe50a481f78c1b8aa0f14afebd3d8ea3f532a49 Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Sat, 13 Jan 2018 14:27:24 +0100 Subject: [PATCH] Allow building queues from raised/lowered entrances The original code assumes the entrance is at the exact same height as the station, which is not always the case with hacked rides. --- src/openrct2/world/Footpath.cpp | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 8fbb13acf1..c5359c4447 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -1598,27 +1598,29 @@ void footpath_queue_chain_push(uint8 rideIndex) */ void footpath_update_queue_chains() { - for (uint8 *queueChainPtr = _footpathQueueChain; queueChainPtr < _footpathQueueChainNext; queueChainPtr++) { - uint8 rideIndex = *queueChainPtr; - Ride *ride = get_ride(rideIndex); - if (ride->type == RIDE_TYPE_NULL) { + for (uint8 * queueChainPtr = _footpathQueueChain; queueChainPtr < _footpathQueueChainNext; queueChainPtr++) + { + uint8 rideIndex = *queueChainPtr; + Ride * ride = get_ride(rideIndex); + if (ride->type == RIDE_TYPE_NULL) continue; - } - for (sint32 i = 0; i < MAX_STATIONS; i++) { - if (ride->entrances[i].xy == RCT_XY8_UNDEFINED) { + for (sint32 i = 0; i < MAX_STATIONS; i++) + { + if (ride->entrances[i].xy == RCT_XY8_UNDEFINED) continue; - } - uint8 x = ride->entrances[i].x; - uint8 y = ride->entrances[i].y; - uint8 z = ride->station_heights[i]; - - rct_tile_element *tileElement = map_get_first_element_at(x, y); - do { - if (tile_element_get_type(tileElement) != TILE_ELEMENT_TYPE_ENTRANCE) continue; - if (tileElement->base_height != z) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE) continue; + uint8 x = ride->entrances[i].x; + uint8 y = ride->entrances[i].y; + rct_tile_element * tileElement = map_get_first_element_at(x, y); + do + { + if (tile_element_get_type(tileElement) != TILE_ELEMENT_TYPE_ENTRANCE) + continue; + if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE) + continue; + if (tileElement->properties.entrance.ride_index != rideIndex) + continue; uint8 direction = tile_element_get_direction_with_offset(tileElement, 2); footpath_chain_ride_queue(rideIndex, i, x << 5, y << 5, tileElement, direction);