From 7aaa124cef7b681925f15096c24f503e5d6820a1 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Tue, 27 Jan 2026 22:09:33 +0100 Subject: [PATCH] Fix #15009: Landscaping tools do not display estimates when paused (#25866) --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/ClearScenery.cpp | 1 + src/openrct2-ui/windows/Land.cpp | 31 +++++++++++++++--------- src/openrct2-ui/windows/Water.cpp | 4 +++ 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 0a6d4916b4..ab6b05bc53 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -5,6 +5,7 @@ - Improved: [#25858] macOS now supports the onboarding menu. - Change: [#25018] Add upkeep cost to booster pieces. - Fix: [#4643, #25167] Many metal supports draw with a filled in top when they didn't in vanilla, causing some slight misalignment and glitching. +- Fix: [#15009] Landscaping tools do not display estimates when the game is paused (original bug). - Fix: [#25221] When trying to cancel game file discovery, the prompt reappears. - Fix: [#25739] Game freezes when a tab in the New Ride window contains more than 384 items. - Fix: [#25745] Crash when a player connection is aborted early. diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index 963483c0a2..726b571697 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -288,6 +288,7 @@ namespace OpenRCT2::Ui::Windows return; auto action = GetClearAction(); + action.SetFlags({ GameActions::CommandFlag::allowDuringPaused }); auto result = GameActions::Query(&action, getGameState()); auto cost = (result.error == GameActions::Status::ok ? result.cost : kMoney64Undefined); if (_clearSceneryCost != cost) diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index f6dd8000be..65b9d92d06 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -335,6 +335,21 @@ namespace OpenRCT2::Ui::Windows } private: + static money64 executeGameAction(GameState_t& gameState, GameActions::GameAction* action, SelectionMode mode) + { + GameActions::Result res; + if (mode == SelectionMode::apply) + { + res = GameActions::Execute(action, gameState); + } + else + { + action->SetFlags({ CommandFlag::allowDuringPaused }); + res = GameActions::Query(action, gameState); + } + return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined; + } + /** * * rct2: 0x006644DD @@ -354,18 +369,14 @@ namespace OpenRCT2::Ui::Windows { centreX, centreY }, { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType, false); - auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landSmoothAction, gameState) - : GameActions::Query(&landSmoothAction, gameState); - return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined; + return executeGameAction(gameState, &landSmoothAction, mode); } auto landRaiseAction = GameActions::LandRaiseAction( { centreX, centreY }, { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType); - auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landRaiseAction, gameState) - : GameActions::Query(&landRaiseAction, gameState); - return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined; + return executeGameAction(gameState, &landRaiseAction, mode); } /** @@ -387,18 +398,14 @@ namespace OpenRCT2::Ui::Windows { centreX, centreY }, { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType, true); - auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landSmoothAction, gameState) - : GameActions::Query(&landSmoothAction, gameState); - return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined; + return executeGameAction(gameState, &landSmoothAction, mode); } auto landLowerAction = GameActions::LandLowerAction( { centreX, centreY }, { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType); - auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landLowerAction, gameState) - : GameActions::Query(&landLowerAction, gameState); - return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined; + return executeGameAction(gameState, &landLowerAction, mode); } /** diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index 7dde9ad3ef..467fc47128 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -304,8 +304,10 @@ namespace OpenRCT2::Ui::Windows auto waterLowerAction = GameActions::WaterLowerAction( { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); + waterLowerAction.SetFlags({ GameActions::CommandFlag::allowDuringPaused }); auto waterRaiseAction = GameActions::WaterRaiseAction( { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); + waterRaiseAction.SetFlags({ GameActions::CommandFlag::allowDuringPaused }); auto res = GameActions::Query(&waterLowerAction, gameState); money64 lowerCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined; @@ -394,8 +396,10 @@ namespace OpenRCT2::Ui::Windows auto waterLowerAction = GameActions::WaterLowerAction( { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); + waterLowerAction.SetFlags({ GameActions::CommandFlag::allowDuringPaused }); auto waterRaiseAction = GameActions::WaterRaiseAction( { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }); + waterRaiseAction.SetFlags({ GameActions::CommandFlag::allowDuringPaused }); auto res = GameActions::Query(&waterLowerAction, gameState); money64 lowerCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;