Created
January 12, 2018 16:03
-
-
Save Broxzier/9fec1b15ddc23f59ddc24a1d69688b2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp | |
index 6fc985a8f..84013d1b1 100644 | |
--- a/src/openrct2/peep/Peep.cpp | |
+++ b/src/openrct2/peep/Peep.cpp | |
@@ -2890,7 +2890,31 @@ static void peep_update_ride_sub_state_1(rct_peep * peep) | |
invalidate_sprite_2((rct_sprite *)peep); | |
- z = ride->station_heights[peep->current_ride_station] * 8; | |
+ // Find entrance height, in case its height differs from the station height through hacks | |
+ LocationXY8 xy = ride->entrances[peep->current_ride_station]; | |
+ rct_tile_element * entrance_element = nullptr; | |
+ rct_tile_element * tile_element = map_get_first_element_at(xy.x, xy.y); | |
+ do | |
+ { | |
+ if (tile_element_get_type(tile_element) != TILE_ELEMENT_TYPE_ENTRANCE) | |
+ continue; | |
+ if (tile_element->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE) | |
+ continue; | |
+ if (tile_element->properties.entrance.ride_index != peep->current_ride) | |
+ continue; | |
+ if (tile_element->properties.entrance.index >> 6 != peep->current_ride_station) | |
+ continue; | |
+ | |
+ // It is possible that there are multiple entrances of the same ride and same station on the same tile | |
+ // Instead of just picking one, pick the first and only overwrite it if the new height matches the station | |
+ if (entrance_element == nullptr || tile_element->base_height == ride->station_heights[peep->current_ride_station]) | |
+ entrance_element = tile_element; | |
+ } while (!tile_element_is_last_for_tile(tile_element++)); | |
+ | |
+ if (entrance_element != nullptr) | |
+ z = entrance_element->base_height * 8; | |
+ else | |
+ z = ride->station_heights[peep->current_ride_station] * 8; | |
distanceThreshold += 4; | |
if (xy_distance < distanceThreshold) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment