forked from rosebudai/OpenRCT2-Web
Merge pull request #25857 from matheusvb3/addclamp-final
Clamp some Guest and ParkData fields
This commit is contained in:
2 files changed
+8
-10
No files matched your search
@@ -1014,7 +1014,7 @@ void Guest::Tick128UpdateGuest(uint32_t index)
|
||||
|
||||
if (State == PeepState::onRide || State == PeepState::enteringRide)
|
||||
{
|
||||
GuestTimeOnRide = std::min(255, GuestTimeOnRide + 1);
|
||||
GuestTimeOnRide = AddClamp<uint8_t>(GuestTimeOnRide, 1);
|
||||
|
||||
if (PeepFlags & PEEP_FLAGS_WOW)
|
||||
{
|
||||
@@ -2354,9 +2354,9 @@ void Guest::SpendMoney(money64& peep_expend_type, money64 amount, ExpenditureTyp
|
||||
assert(!(getGameState().park.flags & PARK_FLAGS_NO_MONEY));
|
||||
|
||||
CashInPocket = std::max(0.00_GBP, CashInPocket - amount);
|
||||
CashSpent += amount;
|
||||
CashSpent = AddClamp(CashSpent, amount);
|
||||
|
||||
peep_expend_type += amount;
|
||||
peep_expend_type = AddClamp(peep_expend_type, amount);
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->InvalidateByNumber(WindowClass::peep, Id);
|
||||
|
||||
@@ -1279,12 +1279,9 @@ void PeepUpdateDaysInQueue()
|
||||
{
|
||||
for (auto peep : EntityList<Guest>())
|
||||
{
|
||||
if (!peep->OutsideOfPark && peep->State == PeepState::queuing)
|
||||
if (!peep->OutsideOfPark && (peep->State == PeepState::queuing))
|
||||
{
|
||||
if (peep->DaysInQueue < 255)
|
||||
{
|
||||
peep->DaysInQueue += 1;
|
||||
}
|
||||
peep->DaysInQueue = AddClamp<uint8_t>(peep->DaysInQueue, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1916,12 +1913,13 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
|
||||
return true;
|
||||
}
|
||||
|
||||
gameState.park.totalIncomeFromAdmissions += entranceFee;
|
||||
gameState.park.totalIncomeFromAdmissions = AddClamp(gameState.park.totalIncomeFromAdmissions, entranceFee);
|
||||
guest->SpendMoney(guest->PaidToEnter, entranceFee, ExpenditureType::parkEntranceTickets);
|
||||
guest->PeepFlags |= PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY;
|
||||
}
|
||||
|
||||
getGameState().park.totalAdmissions++;
|
||||
auto& park = getGameState().park;
|
||||
park.totalAdmissions = AddClamp<uint64_t>(park.totalAdmissions, 1);
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->InvalidateByNumber(WindowClass::parkInformation, 0);
|
||||
|
||||
Reference in new issue
Block a user