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
This commit is contained in:
frozensnowy
2026-05-05 11:23:21 +02:00
committed by GitHub
parent e65fb01160
commit 4638d3f505
3 changed files with 27 additions and 0 deletions
+1
View File
@@ -17,6 +17,7 @@
- Fix: [#26421] Wrong scenery tab highlighted when more than 64 scenery groups are selected.
- Fix: [#26425] Benches dont 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 dont 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)
------------------------------------------------------------------------
+12
View File
@@ -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<money64>(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;
+14
View File
@@ -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<money64>(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;