1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 07:44:38 +01:00

Prevent ride and stall statistics from overflowing (#24378)

* Prevent ride and stall statistic from overflowing

Clamps guestsFavourite, totalCustomers, lastInspection, totalProfit, numPrimaryItemsSold and numSecondaryItemsSold

* Change line of comment in Ride.h

This caused the tooltip with the comment to appear when hovering over notFixedTimeout instead of breakdownSoundModifier in Visual Studio

* Remove redundant overflow prevention

* Invalidate maintenance tab

Missed this before. Also fix an issue I inadvertently caused with PR #23719 when updating the count of vandals stopped

* Deduce lastInspection type in compile time

* Add changelog entry
This commit is contained in:
matheusvb3
2025-05-30 21:10:36 -03:00
committed by GitHub
parent e6ea31b7e9
commit 8dd7b7976f
6 changed files with 18 additions and 16 deletions

View File

@@ -50,6 +50,7 @@
#include "../ride/Station.h"
#include "../ride/Track.h"
#include "../ui/WindowManager.h"
#include "../util/Util.h"
#include "../windows/Intent.h"
#include "../world/Climate.h"
#include "../world/ConstructionClearance.h"
@@ -2274,7 +2275,7 @@ static bool PeepInteractWithShop(Peep* peep, const CoordsXYE& coords)
auto cost = ride->price[0];
if (cost != 0 && !(getGameState().park.Flags & PARK_FLAGS_NO_MONEY))
{
ride->totalProfit += cost;
ride->totalProfit = AddClamp(ride->totalProfit, cost);
ride->windowInvalidateFlags |= RIDE_INVALIDATE_RIDE_INCOME;
guest->SpendMoney(cost, ExpenditureType::ParkRideTickets);
}