1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Fix #10602: Error adding track scenery additions far from station start

Issue caused due to stuffing a temporary unsigned variable in a signed variable. This fix is not a permanent fix and this field in the future should be split up into two separate fields: tile position and relative tile position.

Co-authored-by: Gymnasiast <m.o.steenbeek@gmail.com>
This commit is contained in:
Duncan
2020-03-13 08:32:05 +00:00
committed by GitHub
parent de6e6e9d8f
commit 3003e1de75

View File

@@ -528,7 +528,9 @@ rct_string_id TrackDesign::CreateTrackDesignScenery()
}
}
CoordsXY sceneryMapPos{ scenery.x * 32 - gTrackPreviewOrigin.x, scenery.y * 32 - gTrackPreviewOrigin.y };
// Cast the value into a uint8_t as this value is not signed yet.
auto sceneryPos = TileCoordsXY(static_cast<uint8_t>(scenery.x), static_cast<uint8_t>(scenery.y)).ToCoordsXY();
CoordsXY sceneryMapPos = sceneryPos - gTrackPreviewOrigin;
CoordsXY rotatedSceneryMapPos = sceneryMapPos.Rotate(0 - _saveDirection);
TileCoordsXY sceneryTilePos{ rotatedSceneryMapPos };