From 955ce1e3263ad6068420fe63a9cf76d07b33fdc2 Mon Sep 17 00:00:00 2001 From: mix Date: Sun, 14 Dec 2025 02:44:20 +0000 Subject: [PATCH 1/2] Fix patrol area tool allowing right click removal of paths and scenery --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/LandRights.cpp | 1 - src/openrct2-ui/windows/PatrolArea.cpp | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index de24f0db46..3b0df0f515 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -22,6 +22,7 @@ - Fix: [#25592] Log flume, river rapids, & splash boats can get control failure breakdown instead of brakes failure. - Fix: [#25628] Availability of AVX2 and SSE4.1 is not detected correctly. - Fix: [#25642] The selection marker for purchasing land rights is not drawn with the correct colours. +- Fix: [#25646] It is possible to remove scenery and paths when setting staff patrol areas and purchasing land. 0.4.29 (2025-11-22) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 13ec9fd400..134320c47a 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -109,7 +109,6 @@ namespace OpenRCT2::Ui::Windows _landRightsMode = mode; ToolSet(*this, widgetIndex, Tool::upArrow); - gInputFlags.set(InputFlag::unk6); if (kLandRightsVisibleByMode[EnumValue(mode)]) ShowLandRights(); diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index 8c8f88ae61..e05be57ae3 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -249,7 +249,6 @@ namespace OpenRCT2::Ui::Windows if (!ToolSet(*this, 0, Tool::walkDown)) { ShowGridlines(); - gInputFlags.set(InputFlag::unk6); SetPatrolAreaToRender(_staffId); GfxInvalidateScreen(); } From 6414cf26a34d622fc669cc4ee511d1dab394215a Mon Sep 17 00:00:00 2001 From: mix Date: Sun, 14 Dec 2025 02:51:38 +0000 Subject: [PATCH 2/2] Rename InputFlag::unk6 to allowRightMouseRemoval --- src/openrct2-ui/interface/ViewportInteraction.cpp | 2 +- src/openrct2-ui/windows/ClearScenery.cpp | 2 +- src/openrct2-ui/windows/EditorParkEntrance.cpp | 2 +- src/openrct2-ui/windows/Footpath.cpp | 8 ++++---- src/openrct2-ui/windows/Land.cpp | 2 +- src/openrct2-ui/windows/MazeConstruction.cpp | 2 +- src/openrct2-ui/windows/RideConstruction.cpp | 6 +++--- src/openrct2-ui/windows/Scenery.cpp | 4 ++-- src/openrct2-ui/windows/TrackDesignPlace.cpp | 2 +- src/openrct2-ui/windows/Water.cpp | 2 +- src/openrct2/Input.h | 4 +--- src/openrct2/interface/Window.cpp | 2 +- src/openrct2/ride/RideConstruction.cpp | 4 ++-- 13 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 8a7d92cb94..a49ff97d73 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -467,7 +467,7 @@ namespace OpenRCT2::Ui break; } - if (!gInputFlags.has(InputFlag::unk6) || !gInputFlags.has(InputFlag::toolActive)) + if (!gInputFlags.has(InputFlag::allowRightMouseRemoval) || !gInputFlags.has(InputFlag::toolActive)) { auto* windowMgr = GetWindowManager(); if (windowMgr->FindByClass(WindowClass::rideConstruction) == nullptr diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index e80a3f9a9b..201f1f42b2 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -384,7 +384,7 @@ namespace OpenRCT2::Ui::Windows ShowGridlines(); auto* toolWindow = ContextOpenWindow(WindowClass::clearScenery); ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::bulldozer); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); } } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/EditorParkEntrance.cpp b/src/openrct2-ui/windows/EditorParkEntrance.cpp index 6226bd5a05..4bc14ab6d7 100644 --- a/src/openrct2-ui/windows/EditorParkEntrance.cpp +++ b/src/openrct2-ui/windows/EditorParkEntrance.cpp @@ -272,7 +272,7 @@ namespace OpenRCT2::Ui::Windows pressedWidgets |= 1LL << WIDX_TAB; ToolSet(*this, WIDX_LIST, Tool::entranceDown); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); } void onMouseUp(WidgetIndex widgetIndex) override diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 30c087d756..7f89c38540 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -241,7 +241,7 @@ namespace OpenRCT2::Ui::Windows ToolCancel(); _footpathConstructionMode = PathConstructionMode::onLand; ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::pathDown); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); _footpathErrorOccured = false; WindowFootpathSetEnabledAndPressedWidgets(); @@ -348,7 +348,7 @@ namespace OpenRCT2::Ui::Windows gMapSelectFlags.unset(MapSelectFlag::enableConstruct); _footpathConstructionMode = PathConstructionMode::dragArea; ToolSet(*this, WIDX_CONSTRUCT_DRAG_AREA, Tool::pathDown); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); _footpathErrorOccured = false; WindowFootpathSetEnabledAndPressedWidgets(); } @@ -372,7 +372,7 @@ namespace OpenRCT2::Ui::Windows gMapSelectFlags.unset(MapSelectFlag::enableConstruct); _footpathConstructionMode = PathConstructionMode::onLand; ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::pathDown); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); _footpathErrorOccured = false; WindowFootpathSetEnabledAndPressedWidgets(); break; @@ -396,7 +396,7 @@ namespace OpenRCT2::Ui::Windows gMapSelectFlags.unset(MapSelectFlag::enableConstruct); _footpathConstructionMode = PathConstructionMode::bridgeOrTunnelPick; ToolSet(*this, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, Tool::crosshair); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); _footpathErrorOccured = false; WindowFootpathSetEnabledAndPressedWidgets(); break; diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 84e4aa0a1b..2aa570bd01 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -895,7 +895,7 @@ namespace OpenRCT2::Ui::Windows ShowGridlines(); auto* toolWindow = ContextOpenWindow(WindowClass::land); ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::digDown); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); } } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index d3ec79be04..94aa0c51a1 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -319,7 +319,7 @@ namespace OpenRCT2::Ui::Windows : ENTRANCE_TYPE_RIDE_EXIT; gRideEntranceExitPlaceRideIndex = rideId; gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); RideConstructionInvalidateCurrentTrack(); diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index c9cae93084..a4cfc22738 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -2508,7 +2508,7 @@ namespace OpenRCT2::Ui::Windows gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_ENTRANCE; gRideEntranceExitPlaceRideIndex = _currentRideIndex; gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); RideConstructionInvalidateCurrentTrack(); if (_rideConstructionState != RideConstructionState::EntranceExit) { @@ -2534,7 +2534,7 @@ namespace OpenRCT2::Ui::Windows gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_EXIT; gRideEntranceExitPlaceRideIndex = _currentRideIndex; gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); RideConstructionInvalidateCurrentTrack(); if (_rideConstructionState != RideConstructionState::EntranceExit) { @@ -3728,7 +3728,7 @@ namespace OpenRCT2::Ui::Windows if (w != nullptr) { ToolSet(*w, WIDX_CONSTRUCT, Tool::crosshair); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); _trackPlaceCtrlState = false; _trackPlaceShiftState = false; } diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 54708747a7..417a22fb4e 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -561,7 +561,7 @@ namespace OpenRCT2::Ui::Windows _inDragMode = false; ToolSet(*this, WIDX_SCENERY_BACKGROUND, Tool::arrow); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); } else { @@ -3506,7 +3506,7 @@ namespace OpenRCT2::Ui::Windows { auto* toolWindow = ContextOpenWindow(WindowClass::scenery); ToolSet(*toolWindow, WIDX_SCENERY_BACKGROUND, Tool::arrow); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); } } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index d4ed7035d3..97d689e63d 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -110,7 +110,7 @@ namespace OpenRCT2::Ui::Windows setWidgets(_trackPlaceWidgets); WindowInitScrollWidgets(*this); ToolSet(*this, WIDX_PRICE, Tool::crosshair); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); WindowPushOthersRight(*this); ShowGridlines(); _miniPreview.resize(kTrackMiniPreviewSize.width * kTrackMiniPreviewSize.height); diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 0f534b51df..c427f593b9 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -443,7 +443,7 @@ namespace OpenRCT2::Ui::Windows ShowGridlines(); auto* toolWindow = ContextOpenWindow(WindowClass::water); ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::waterDown); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); } } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2/Input.h b/src/openrct2/Input.h index 04efdf88b4..7411b8cc34 100644 --- a/src/openrct2/Input.h +++ b/src/openrct2/Input.h @@ -33,9 +33,7 @@ namespace OpenRCT2 rightMousePressed, - // Some of the map tools (clear, footpath, scenery) - // never read as far as I know. - unk6, + allowRightMouseRemoval, viewportScrolling, }; diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 907f4b40e5..01bb4699c6 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -678,7 +678,7 @@ static constexpr float kWindowScrollLocations[][2] = { gInputFlags.set(InputFlag::toolActive); gInputFlags.unset(InputFlag::leftMousePressed); - gInputFlags.unset(InputFlag::unk6); + gInputFlags.unset(InputFlag::allowRightMouseRemoval); gCurrentToolId = tool; gCurrentToolWidget.windowClassification = w.classification; gCurrentToolWidget.windowNumber = w.number; diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index b2cf3d09a9..de473eba30 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -889,7 +889,7 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement) gRideEntranceExitPlaceType = entranceType; gRideEntranceExitPlaceRideIndex = rideIndex; gRideEntranceExitPlaceStationIndex = stationIndex; - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); if (_rideConstructionState != RideConstructionState::EntranceExit) { gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState; @@ -1080,7 +1080,7 @@ int32_t RideInitialiseConstructionWindow(Ride& ride) w = ride_create_or_find_construction_window(ride.id); ToolSet(*w, WC_RIDE_CONSTRUCTION__WIDX_CONSTRUCT, Tool::crosshair); - gInputFlags.set(InputFlag::unk6); + gInputFlags.set(InputFlag::allowRightMouseRemoval); _currentlySelectedTrack = ride.getRideTypeDescriptor().StartTrackPiece; _currentTrackPitchEnd = TrackPitch::None;