1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 07:14:31 +01:00

Fix #6830: Crash when using mountain tool due to ride with no entry

This commit is contained in:
Ted John
2017-12-16 12:21:25 +00:00
parent 6e34aaa321
commit 4aff132fd7
2 changed files with 28 additions and 14 deletions

View File

@@ -78,6 +78,7 @@
- Fix: [#6547] The server log is not logged if the server name contains CJK
- Fix: [#6593] Cannot hire entertainers when default scenery groups are not selected (original bug).
- Fix: [#6657] Guest list is missing tracking icon after reopening.
- Fix: [#6830] Crash when using mountain tool due to ride with no ride entry.
- Fix: Infinite loop when removing scenery elements with >127 base height.
- Fix: Ghosting of transparent map elements when the viewport is moved in OpenGL mode.
- Fix: Clear IME buffer after committing composed text.

View File

@@ -1573,24 +1573,37 @@ static money32 map_set_land_height(sint32 flags, sint32 x, sint32 y, sint32 heig
} while (!tile_element_is_last_for_tile(tileElement++));
}
//Check for ride support limits
if(gCheatsDisableSupportLimits==false)
// Check for ride support limits
if (!gCheatsDisableSupportLimits)
{
tileElement = map_get_first_element_at(x / 32, y / 32);
do{
if(tile_element_get_type(tileElement) != TILE_ELEMENT_TYPE_TRACK)
continue;
sint32 rideIndex = track_element_get_ride_index(tileElement);
sint32 maxHeight = get_ride_entry_by_ride(get_ride(rideIndex))->max_height;
if(maxHeight == 0)
maxHeight = RideData5[get_ride(rideIndex)->type].max_height;
sint32 zDelta = tileElement->clearance_height - height;
if(zDelta >= 0 && zDelta/2 > maxHeight)
do
{
if (tile_element_get_type(tileElement) == TILE_ELEMENT_TYPE_TRACK)
{
gGameCommandErrorText = STR_SUPPORTS_CANT_BE_EXTENDED;
return MONEY32_UNDEFINED;
sint32 rideIndex = track_element_get_ride_index(tileElement);
Ride * ride = get_ride(rideIndex);
if (ride != NULL)
{
rct_ride_entry * rideEntry = get_ride_entry_by_ride(ride);
if (rideEntry != NULL)
{
sint32 maxHeight = rideEntry->max_height;
if (maxHeight == 0)
{
maxHeight = RideData5[get_ride(rideIndex)->type].max_height;
}
sint32 zDelta = tileElement->clearance_height - height;
if (zDelta >= 0 && zDelta / 2 > maxHeight)
{
gGameCommandErrorText = STR_SUPPORTS_CANT_BE_EXTENDED;
return MONEY32_UNDEFINED;
}
}
}
}
}while(!tile_element_is_last_for_tile(tileElement++));
}
while(!tile_element_is_last_for_tile(tileElement++));
}
uint8 zCorner = height; //z position of highest corner of tile