Other Park, the same problem:-(
I think I've identified the problem:
--- Scenario.cpp ---
static void scenario_entrance_fee_too_high_check()
{
const auto max_fee = add_clamp_money16(gTotalRideValueForMoney, gTotalRideValueForMoney / 2);
if ((gParkFlags & PARK_FLAGS_PARK_OPEN) && ParkGetEntranceFee() > max_fee)
{
...
News::AddItemToQueue(News::ItemType::Blank, STR_ENTRANCE_FEE_TOO_HI, packed_xy, {});
--- other .cpp/.h ---
money16 gTotalRideValueForMoney;
using money16 = fixed16_1dp;
using fixed16_1dp = int16_t;
INT16_MAX = 32767;
---
Viewing these Variables with scrip:
ok
'park.totalRideValueForMoney: 32328'
'park.entranceFee: 0'
with problems
'park.totalRideValueForMoney: -32730'
'park.entranceFee: 0'
---
The 16-Bit signed variable "gTotalRideValueForMoney" has an overflow and makes a wrap to negative!
This value is using not only for message "ENTRANCE_FEE_TOO_HI", other functions for rating(?) use this...
Manual addition of all rides = 32806 (see ride_all.xlsx) => b 10000000 00100110 => -32730
sumery of 641 from 1000 (rideCount /OpenRCT2::Limits::MaxRidesInPark)
Suggestion for quick fix:
--- Ride.cpp ---
uint16_t value;
--- Park.cpp ---
gTotalRideValueForMoney = CalculateTotalRideValueForMoney();
...
money16 Park::CalculateTotalRideValueForMoney() const
{
money16 totalRideValue = 0; => int32_t totalRideValue = 0;
bool ridePricesUnlocked = ParkRidePricesUnlocked() && !(gParkFlags & PARK_FLAGS_NO_MONEY);
for (auto& ride : GetRideManager())
{
if (ride.status != RideStatus::Open)
continue;
if (ride.lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
continue;
if (ride.lifecycle_flags & RIDE_LIFECYCLE_CRASHED)
continue;
// Add ride value
if (ride.value != RIDE_VALUE_UNDEFINED)
{
money16 rideValue = static_cast<money16>(ride.value); => int32_t rideValue = static_cast<int32_t>(ride.value);
if (ridePricesUnlocked)
{
rideValue -= ride.price[0];
}
if (rideValue > 0)
{
totalRideValue += rideValue * 2;
}
}
}
// saturation result to int16
if (totalRideValue <= INT16_MAX)
return static_cast<money16>(totalRideValue);
else
return INT16_MAX;
}
---
Maybe someone who is allowed to edit code can take care of this problem?
ride_all.xlsx
t010-124-error.park