From f579c277c4439f0c567701879c4535d0893f754d Mon Sep 17 00:00:00 2001 From: martip23 Date: Sun, 6 May 2018 02:39:07 -0500 Subject: [PATCH 1/3] Iterate and check for each element's height for cover. Fixes #7405 --- src/openrct2/ride/Vehicle.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 204a2104a0..0ecad28721 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -1819,9 +1819,10 @@ static void vehicle_update_measurements(rct_vehicle * vehicle) if (ride_get_entrance_location(ride, ride->current_test_station).isNull()) return; - sint16 x, y; + sint16 x, y, z; x = vehicle->x; y = vehicle->y; + z = vehicle->z; if (x == LOCATION_NULL) { @@ -1830,12 +1831,20 @@ static void vehicle_update_measurements(rct_vehicle * vehicle) } rct_tile_element * tile_element = map_get_surface_element_at({x, y}); - if (tile_element->base_height * 8 <= vehicle->z) + // If vehicle above ground. + if (tile_element->base_height * 8 <= z) { + // Set tile_element to first element. Since elements aren't always ordered by base height, + // we must start at the first element and iterate through each tile element. + tile_element = map_get_first_element_at(x / 32, y / 32); bool cover_found = false; do { + // If the tile_element is lower than the vehicle, continue (don't set flag) + if (tile_element->base_height * 8 <= z) + continue; + if (tile_element->GetType() == TILE_ELEMENT_TYPE_LARGE_SCENERY) { cover_found = true; @@ -1857,6 +1866,7 @@ static void vehicle_update_measurements(rct_vehicle * vehicle) cover_found = true; break; } + // Iterate through each tile_element. } while (!tile_element_is_last_for_tile(tile_element++)); if (cover_found == false) From aca3f1888ed7820f91e46cede107d068b3f5fd22 Mon Sep 17 00:00:00 2001 From: martip23 Date: Sun, 6 May 2018 02:47:45 -0500 Subject: [PATCH 2/3] Add to contributors --- contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/contributors.md b/contributors.md index c38be83f54..79f78e7012 100644 --- a/contributors.md +++ b/contributors.md @@ -110,6 +110,7 @@ The following people are not part of the project team, but have been contributin * (Deurklink) * Nathan Zabriskie (NathanZabriskie) * Toby Hinloopen (tobyhinloopen) +* Patrick Martinez (martip23) ## Toolchain * (Balletie) - macOS From eaae4533528ac3f0a766496867b69b7f730ef969 Mon Sep 17 00:00:00 2001 From: martip23 Date: Sun, 6 May 2018 15:58:25 -0500 Subject: [PATCH 3/3] Updated changelog --- distribution/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 1945eda245..75ac458c24 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -18,6 +18,7 @@ - Fix: [#7327] Abstract scenery and stations don't get fully See-Through when hiding them (original bug). - Fix: [#7382] Opening the mini-map reverts the size of the land tool to 1x1, regardless of what was selected before. - Fix: [#7402] Edges of neigbouring footpaths stay connected after removing a path that's underneath a ride entrance. +- Fix: [#7405] Rides can be covered by placing scenery underneath them. - Fix: [#7436] Only the first 32 vehicles of a train can be painted. - Fix: Cut-away view does not draw tile elements that have been moved down on the list. - Improved: [#2989] Multiplayer window now changes title when tab changes.