From 4638d3f5052949ac82a357a1946c32028e669c29 Mon Sep 17 00:00:00 2001 From: frozensnowy Date: Tue, 5 May 2026 11:23:21 +0200 Subject: [PATCH] Fix #26492: Drag tool shows per tile error when running out of money midway (#26493) The path and wall drag tools query each tile individually for affordability so all queries pass when the player can afford any single tile. But if the total exceeds available funds, execution fails midway with per tile error windows. To fix it this adds a total cost check against available funds after the query phase, showing a single combined error with the full cost before execution actually starts --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/Footpath.cpp | 12 ++++++++++++ src/openrct2-ui/windows/Scenery.cpp | 14 ++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index c0fb676784..af442c0a18 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -17,6 +17,7 @@ - Fix: [#26421] Wrong scenery tab highlighted when more than 64 scenery groups are selected. - Fix: [#26425] Benches don’t reduce watching spots from 4 to 2 while other path additions do (should be reversed). - Fix: [#26432] Guests choose to head for rides they have already ridden if they don’t have a map. +- Fix: [#26492] Drag tool shows per-tile error instead of total cost when running out of money midway through placement. 0.5.0 (2026-04-12) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 72eacf7c17..9143c15f18 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -1319,6 +1319,18 @@ namespace OpenRCT2::Ui::Windows return; } + if (!(getGameState().park.flags & PARK_FLAGS_NO_MONEY) && totalCost > getGameState().park.cash) + { + Audio::Play3D(Audio::SoundId::error, lastLocation); + _footpathErrorOccured = true; + + auto* windowMgr = GetWindowManager(); + Formatter ft; + ft.Add(totalCost); + windowMgr->ShowError(STR_CANT_BUILD_FOOTPATH_HERE, STR_NOT_ENOUGH_CASH_REQUIRES, ft); + return; + } + // All queries passed, now execute bool anySuccess = false; money64 cost = 0; diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 3ceda67f12..77852fff50 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -3291,6 +3291,20 @@ namespace OpenRCT2::Ui::Windows return; } + if (!(getGameState().park.flags & PARK_FLAGS_NO_MONEY) && totalCost > getGameState().park.cash) + { + Audio::Play3D(Audio::SoundId::error, lastLocation); + + auto* windowMgr = GetWindowManager(); + Formatter ft; + ft.Add(totalCost); + windowMgr->ShowError(STR_CANT_BUILD_THIS_HERE, STR_NOT_ENOUGH_CASH_REQUIRES, ft); + + _provisionalTiles.clear(); + _inDragMode = false; + return; + } + // All queries passed, now execute bool anySuccessful = false;