From 16936d4ea15fef55645313e0afcc4d64932238c2 Mon Sep 17 00:00:00 2001 From: Christian Schubert <234248+Osmodium@users.noreply.github.com> Date: Sun, 23 Sep 2018 17:38:59 +0200 Subject: [PATCH] Fix #7828: Copied entrances and exits stay when demolishing ride (#7932) --- contributors.md | 1 + distribution/changelog.txt | 1 + src/openrct2/actions/RideDemolishAction.hpp | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/contributors.md b/contributors.md index 73ff1c7d2e..106664dba2 100644 --- a/contributors.md +++ b/contributors.md @@ -114,6 +114,7 @@ The following people are not part of the development team, but have been contrib * Andy Ford (AndyTWF) * Matthew Beaudin (mattbeaudin) * Øystein Dale (oystedal) +* Christian Schubert (Osmodium) ## Toolchain * (Balletie) - macOS diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 4524e16894..dd436137a7 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -3,6 +3,7 @@ - Feature: [#7956, #7964] Add sprite font glyphs for Hungarian and some Czech letters. - Feature: [#7971] Toolbox option to open custom content folder. - Feature: [#7980] Allow data path for RCT1 to be specified by a command line argument. +- Fix: [#7828] Copied entrances and exits stay when demolishing ride. - Fix: [#7954] Key validation fails on Windows due to non-ASCII user / player name. - Fix: [#7975] Inspection flag not cleared for rides which are set to never be inspected (Original bug). - Improved: [#2940] Allow mouse-dragging to set patrol area (Singleplayer only). diff --git a/src/openrct2/actions/RideDemolishAction.hpp b/src/openrct2/actions/RideDemolishAction.hpp index c73bfc351f..ccb6337b0f 100644 --- a/src/openrct2/actions/RideDemolishAction.hpp +++ b/src/openrct2/actions/RideDemolishAction.hpp @@ -284,7 +284,24 @@ private: tile_element_iterator_begin(&it); while (tile_element_iterator_next(&it)) { - if (it.element->GetType() != TILE_ELEMENT_TYPE_TRACK) + uint8_t tile_type = it.element->GetType(); + + if (tile_type == TILE_ELEMENT_TYPE_ENTRANCE) + { + uint8_t type = track_element_get_type(it.element); + if (type == ENTRANCE_TYPE_PARK_ENTRANCE) + continue; + + if (track_element_get_ride_index(it.element) == _rideIndex) + { + tile_element_remove(it.element); + tile_element_iterator_restart_for_tile(&it); + } + + continue; + } + + if (tile_type != TILE_ELEMENT_TYPE_TRACK) continue; if (track_element_get_ride_index(it.element) != _rideIndex)