1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 14:54:30 +01:00

Fix #4265: Delete trackpiece bug

Safely handle invalid track pieces when demolishing a ride.
This commit is contained in:
Ted John
2016-10-01 14:12:52 +01:00
parent 3f767ed8ff
commit 23094d25bb

View File

@@ -5679,7 +5679,7 @@ int ride_get_refund_price(int ride_id)
uint8 type = it.element->properties.track.type;
if (type != TRACK_ELEM_INVERTED_90_DEG_UP_TO_FLAT_QUARTER_LOOP){
refundPrice += game_do_command(
money32 removePrice = game_do_command(
x,
GAME_COMMAND_FLAG_APPLY | (rotation << 8),
y,
@@ -5687,6 +5687,11 @@ int ride_get_refund_price(int ride_id)
GAME_COMMAND_REMOVE_TRACK,
z,
0);
if (removePrice == MONEY32_UNDEFINED) {
map_element_remove(it.element);
} else {
refundPrice += removePrice;
}
map_element_iterator_restart_for_tile(&it);
continue;
}