From 3e9356857f6677cd1cea26ac07bf356dde21b4c9 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sat, 6 Apr 2019 18:06:40 +0100 Subject: [PATCH] Fix wall placement in track designs. X and Y values go a bit screwey in ride previews. So you need to override there check. Also fixed the wall from nesting the command wrong --- src/openrct2/actions/WallPlaceAction.hpp | 5 +++-- src/openrct2/ride/TrackDesign.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/openrct2/actions/WallPlaceAction.hpp b/src/openrct2/actions/WallPlaceAction.hpp index 62bb6835bf..e2c55ee387 100644 --- a/src/openrct2/actions/WallPlaceAction.hpp +++ b/src/openrct2/actions/WallPlaceAction.hpp @@ -14,6 +14,7 @@ #include "../ride/RideGroupManager.h" #include "../ride/Track.h" #include "../ride/TrackData.h" +#include "../ride/TrackDesign.h" #include "../world/Banner.h" #include "../world/LargeScenery.h" #include "../world/MapAnimation.h" @@ -71,7 +72,7 @@ public: res->Position.x += 16; res->Position.y += 16; - if (res->Position.z == 0) + if (_loc.z == 0) { res->Position.z = tile_element_height(res->Position.x, res->Position.y) & 0xFFFF; } @@ -91,7 +92,7 @@ public: return MakeResult(GA_ERROR::NOT_OWNED, STR_CANT_BUILD_PARK_ENTRANCE_HERE); } } - else if ((_loc.x > gMapSizeMaxXY || _loc.y > gMapSizeMaxXY)) + else if (!byte_9D8150 && (_loc.x > gMapSizeMaxXY || _loc.y > gMapSizeMaxXY)) { log_error("Invalid x/y coordinates. x = %d y = %d", _loc.x, _loc.y); return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_BUILD_PARK_ENTRANCE_HERE); diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 35debd6efe..f9091f7a42 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -961,8 +961,8 @@ static bool TrackDesignPlaceSceneryElement( entry_index, { mapCoord.x, mapCoord.y, z }, rotation, scenery->primary_colour, scenery->secondary_colour, scenery->flags & 0xFC); wallPlaceAction.SetFlags(flags); - auto res = flags & GAME_COMMAND_FLAG_APPLY ? GameActions::Execute(&wallPlaceAction) - : GameActions::Query(&wallPlaceAction); + auto res = flags & GAME_COMMAND_FLAG_APPLY ? GameActions::ExecuteNested(&wallPlaceAction) + : GameActions::QueryNested(&wallPlaceAction); cost = res->Cost; break;