From 3a3cd183215fc008dda2f72641ee99dd133f59bc Mon Sep 17 00:00:00 2001 From: Ken Reese Date: Tue, 19 Sep 2023 06:59:18 -0600 Subject: [PATCH] Fix #19722: "Forbid tree removal" doesn't apply to large trees --- distribution/changelog.txt | 3 ++- src/openrct2/actions/LargeSceneryRemoveAction.cpp | 11 +++++++++++ src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/object/LargeSceneryEntry.h | 7 ++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 73a43fb063..d637a1998a 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -3,6 +3,7 @@ - Change: [#20790] Default ride price set to free if park charges for entry. - Fix: [#20737] Spent money in player window underflows when getting refunds. - Fix: [#20778] [Plugin] Incorrect target api when executing custom actions. +- Fix: [#19722] “Forbid tree removal” restriction doesn't forbid removal of large scenery tree items. 0.4.6 (2023-09-03) ------------------------------------------------------------------------ @@ -10,7 +11,7 @@ - Feature: [#20680] New title sequences (https://github.com/OpenRCT2/title-sequences/releases/tag/v0.4.6). - Feature: [OpenMusic#41] Official Title Theme by Allister Brimble. - Improved: [#20119, #20243] Add new colour presets to several roller coasters (using the new colours). -- Improved: [#20393, #20410] Add Cyrillic characters Ґґ, Ѕѕ, Єє, Іі, Її, and Јј to the sprite font. +- Improved: [#20393, #20410] Add Cyrillic characters Ґґ, Ѕѕ, Єє, Іі, Її, and Јј to the sprite font. - Change: [#19785] OpenMusic is now selected by default when opening SC4/SC6 - or creating new - scenarios. - Change: [#20110] Fix a few RCT1 build height parity discrepancies. - Change: [#20550] Change SEK conversion rate from 1 GBP to 0.1 GBP. diff --git a/src/openrct2/actions/LargeSceneryRemoveAction.cpp b/src/openrct2/actions/LargeSceneryRemoveAction.cpp index 1e230e6a7b..762b872dec 100644 --- a/src/openrct2/actions/LargeSceneryRemoveAction.cpp +++ b/src/openrct2/actions/LargeSceneryRemoveAction.cpp @@ -93,6 +93,17 @@ GameActions::Result LargeSceneryRemoveAction::Query() const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { + if (gParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL) + { + if (sceneryEntry->HasFlag(LARGE_SCENERY_FLAG_IS_TREE)) + { + res.Error = GameActions::Status::NoClearance; + res.ErrorTitle = STR_CANT_REMOVE_THIS; + res.ErrorMessage = STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY; + return res; + } + } + if (!MapIsLocationOwned({ currentTile.x, currentTile.y, currentTile.z })) { return GameActions::Result(GameActions::Status::NoClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 884222c409..fbef0267f8 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -43,7 +43,7 @@ // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "1" +#define NETWORK_STREAM_VERSION "2" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION diff --git a/src/openrct2/object/LargeSceneryEntry.h b/src/openrct2/object/LargeSceneryEntry.h index 708ccc46a7..37b2186866 100644 --- a/src/openrct2/object/LargeSceneryEntry.h +++ b/src/openrct2/object/LargeSceneryEntry.h @@ -74,9 +74,14 @@ struct LargeSceneryEntry uint8_t scrolling_mode; LargeSceneryText* text; uint32_t text_image; + + constexpr bool HasFlag(const uint16_t _flags) const + { + return (flags & _flags) != 0; + } }; -enum LARGE_SCENERY_FLAGS +enum LARGE_SCENERY_FLAGS : uint16_t { LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR = (1 << 0), // 0x1 LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR = (1 << 1), // 0x2