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

Merge pull request #15183 from Gymnasiast/backport/small-track-stuff

Small track design changes
This commit is contained in:
Michael Steenbeek
2021-08-08 11:39:41 +02:00
committed by GitHub
2 changed files with 5 additions and 7 deletions

View File

@@ -1267,7 +1267,7 @@ static bool TrackDesignPlaceSceneryElement(
* rct2: 0x006D0964
*/
static int32_t track_design_place_all_scenery(
const std::vector<TrackDesignSceneryElement>& sceneryList, int32_t originX, int32_t originY, int32_t originZ)
const std::vector<TrackDesignSceneryElement>& sceneryList, const CoordsXYZ& origin)
{
for (uint8_t mode = 0; mode <= 1; mode++)
{
@@ -1284,14 +1284,14 @@ static int32_t track_design_place_all_scenery(
for (const auto& scenery : sceneryList)
{
uint8_t rotation = _currentTrackPieceDirection;
TileCoordsXY tileCoords = { originX / COORDS_XY_STEP, originY / COORDS_XY_STEP };
TileCoordsXY tileCoords = TileCoordsXY(origin);
TileCoordsXY offsets = { scenery.x, scenery.y };
tileCoords += offsets.Rotate(rotation);
auto mapCoord = CoordsXYZ{ tileCoords.ToCoordsXY(), originZ };
auto mapCoord = CoordsXYZ{ tileCoords.ToCoordsXY(), origin.z };
track_design_update_max_min_coordinates(mapCoord);
if (!TrackDesignPlaceSceneryElement(mapCoord, mode, scenery, rotation, originZ))
if (!TrackDesignPlaceSceneryElement(mapCoord, mode, scenery, rotation, origin.z))
{
return 0;
}
@@ -1824,8 +1824,7 @@ int32_t place_virtual_track(TrackDesign* td6, uint8_t ptdOperation, bool placeSc
// Scenery elements
if (track_place_success)
{
if (!track_design_place_all_scenery(
td6->scenery_elements, _trackPreviewOrigin.x, _trackPreviewOrigin.y, _trackPreviewOrigin.z))
if (!track_design_place_all_scenery(td6->scenery_elements, _trackPreviewOrigin))
{
return _trackDesignPlaceCost;
}

View File

@@ -207,7 +207,6 @@ static bool map_check_free_elements_and_reorganise(size_t numElementsOnTile, siz
// Check hard cap on num in use tiles (this would be the size of _tileElements immediately after a reorg)
if (_tileElementsInUse + numNewElements > MAX_TILE_ELEMENTS)
{
gGameCommandErrorText = STR_ERR_LANDSCAPE_DATA_AREA_FULL;
return false;
}