From 008ed86bca9c655bf162692153a086d28de7d27d Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sun, 7 Apr 2019 12:02:04 +0100 Subject: [PATCH] Make requested fixes --- src/openrct2-ui/windows/TopToolbar.cpp | 2 +- src/openrct2/actions/BannerSetStyleAction.hpp | 4 ++-- src/openrct2/actions/LargeScenerySetColourAction.hpp | 11 +++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index dd92e78d61..7d605ddb15 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -1058,7 +1058,7 @@ static void repaint_scenery_tool_down(int16_t x, int16_t y, rct_widgetindex widg if (scenery_entry->banner.flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR) { auto repaintScenery = BannerSetColourAction( - { grid_x, grid_y, tile_element->base_height * 8, tile_element->AsBanner()->GetPosition()}, + { grid_x, grid_y, tile_element->base_height * 8, tile_element->AsBanner()->GetPosition() }, gWindowSceneryPrimaryColour); GameActions::Execute(&repaintScenery); diff --git a/src/openrct2/actions/BannerSetStyleAction.hpp b/src/openrct2/actions/BannerSetStyleAction.hpp index 162231bc35..390db7c86f 100644 --- a/src/openrct2/actions/BannerSetStyleAction.hpp +++ b/src/openrct2/actions/BannerSetStyleAction.hpp @@ -161,8 +161,8 @@ public: case BannerSetStyleType::NoEntry: { BannerElement* bannerElement = tileElement->AsBanner(); - banner->flags &= BANNER_FLAG_NO_ENTRY; - banner->flags |= BANNER_FLAG_NO_ENTRY & (_parameter != 0); + banner->flags &= ~BANNER_FLAG_NO_ENTRY; + banner->flags |= (_parameter != 0) ? BANNER_FLAG_NO_ENTRY : 0; uint8_t allowedEdges = 0xF; if (banner->flags & BANNER_FLAG_NO_ENTRY) { diff --git a/src/openrct2/actions/LargeScenerySetColourAction.hpp b/src/openrct2/actions/LargeScenerySetColourAction.hpp index b877c4857e..0888488205 100644 --- a/src/openrct2/actions/LargeScenerySetColourAction.hpp +++ b/src/openrct2/actions/LargeScenerySetColourAction.hpp @@ -130,10 +130,17 @@ private: } } + auto tileElement = map_get_large_scenery_segment(currentTile.x, currentTile.y, _loc.z / 8, _loc.direction, i); + + if (tileElement == nullptr) + { + log_error( + "Large scenery element not found at: x = %d, y = %d, z = %d, direction = %d", _loc.x, _loc.y, _loc.z, + _loc.direction); + return MakeResult(GA_ERROR::UNKNOWN, STR_CANT_REPAINT_THIS); + } if (isExecuting) { - auto tileElement = map_get_large_scenery_segment(currentTile.x, currentTile.y, _loc.z / 8, _loc.direction, i); - tileElement->SetPrimaryColour(_primaryColour); tileElement->SetSecondaryColour(_secondaryColour);