Merge pull request #7491 from martip23/CoveredRideHeightFix

Iterate and check for each element's height for cover. Fixes #7405
This commit is contained in:
Hielke Morsink 2018-05-07 13:44:35 +02:00 committed by GitHub
commit 3c8a2ca55d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -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

View file

@ -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.

View file

@ -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)