From 6dfcc1a8b2d38da973e60ec85010e544d1251500 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sun, 28 Jun 2020 09:05:14 +0100 Subject: [PATCH 1/2] Fix #12065. Incorrect Entrance/Exit location on td preview Unsure when the mistake was made but it could have been prevented by using const on variables that should be const. --- src/openrct2-ui/windows/TrackDesignPlace.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 9b7b3adc70..72364b460e 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -129,7 +129,7 @@ static int32_t window_track_place_get_base_z(const CoordsXY& loc); static void window_track_place_clear_mini_preview(); static void window_track_place_draw_mini_preview(TrackDesign* td6); static void window_track_place_draw_mini_preview_track( - TrackDesign* td6, int32_t pass, CoordsXY origin, CoordsXY min, CoordsXY max); + TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY min, CoordsXY max); static void window_track_place_draw_mini_preview_maze( TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY min, CoordsXY max); static ScreenCoordsXY draw_mini_preview_get_pixel_position(const CoordsXY& location); @@ -565,12 +565,13 @@ static void window_track_place_draw_mini_preview(TrackDesign* td6) } static void window_track_place_draw_mini_preview_track( - TrackDesign* td6, int32_t pass, CoordsXY origin, CoordsXY min, CoordsXY max) + TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY min, CoordsXY max) { uint8_t rotation = (_currentTrackPieceDirection + get_current_rotation()) & 3; const rct_preview_track** trackBlockArray = (ride_type_has_flag(td6->type, RIDE_TYPE_FLAG_HAS_TRACK)) ? TrackBlocks : FlatRideTrackBlocks; + CoordsXY curTrackStart = origin; for (const auto& trackElement : td6->track_elements) { int32_t trackType = trackElement.type; @@ -583,7 +584,7 @@ static void window_track_place_draw_mini_preview_track( const rct_preview_track* trackBlock = trackBlockArray[trackType]; while (trackBlock->index != 255) { - auto rotatedAndOffsetTrackBlock = origin + CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(rotation); + auto rotatedAndOffsetTrackBlock = curTrackStart + CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(rotation); if (pass == 0) { @@ -627,7 +628,7 @@ static void window_track_place_draw_mini_preview_track( const rct_track_coordinates* track_coordinate = &TrackCoordinates[trackType]; trackType *= 10; - auto rotatedAndOfffsetTrack = origin + CoordsXY{ track_coordinate->x, track_coordinate->y }.Rotate(rotation); + auto rotatedAndOfffsetTrack = curTrackStart + CoordsXY{ track_coordinate->x, track_coordinate->y }.Rotate(rotation); rotation += track_coordinate->rotation_end - track_coordinate->rotation_begin; rotation &= 3; if (track_coordinate->rotation_end & 4) @@ -636,7 +637,7 @@ static void window_track_place_draw_mini_preview_track( } if (!(rotation & 4)) { - origin = rotatedAndOfffsetTrack + CoordsDirectionDelta[rotation]; + curTrackStart = rotatedAndOfffsetTrack + CoordsDirectionDelta[rotation]; } } From 0fd185e0aefd9dc5a631b36080dc909b390f4c70 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sun, 28 Jun 2020 09:06:59 +0100 Subject: [PATCH 2/2] Update changelog --- distribution/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 2a7934aeeb..84345cfbdd 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -39,6 +39,7 @@ - Fix: [#11676] Spiral Roller Coaster has regular lift hill available. - Fix: [#11695] Mechanics walk to tile 0, 0 at entrance only stations when trying to fix them. - Fix: [#11953] Incorrect banner text shade colour on wall text. +- Fix: [#12068] Incorrect Entrance/Exit location on track design preview. - Fix: RCT1 scenarios have more items in the object list than are present in the park or the research list. - Improved: [#6530] Allow water and land height changes on park borders. - Improved: [#11390] Build hash written to screenshot metadata.