Merge pull request #12068 from duncanspumpkin/fix_12065

Fix #12065. Incorrect Entrance/Exit location on td preview
This commit is contained in:
Michael Steenbeek 2020-06-28 12:08:27 +02:00 committed by GitHub
commit bdbf12892b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

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

View File

@ -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];
}
}