From ada164ac92c4c4caafb800d8d41c9b7f5bfdeb1f Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sat, 31 Jul 2021 21:39:43 +0200 Subject: [PATCH 1/2] Remove one write to gGameCommandErrorText All callers assume the landscape data area is full if the function returns false and set that error themselves. --- src/openrct2/world/Map.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 8500825095..4dcbba361a 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -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; } From 5a721cc5e282c17eba907c0807a1263eef0dafb6 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sat, 31 Jul 2021 22:33:40 +0200 Subject: [PATCH 2/2] Make track_design_place_all_scenery() take a CoordsXYZ --- src/openrct2/ride/TrackDesign.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 496b2c1e45..8152a9eb48 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1267,7 +1267,7 @@ static bool TrackDesignPlaceSceneryElement( * rct2: 0x006D0964 */ static int32_t track_design_place_all_scenery( - const std::vector& sceneryList, int32_t originX, int32_t originY, int32_t originZ) + const std::vector& 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; }