Fix #5253: RCT1 park value conversion factor too high

This commit is contained in:
Gymnasiast 2017-06-29 18:23:32 +02:00
parent 9148b98928
commit 50a7c40fbd
2 changed files with 26 additions and 3 deletions

View File

@ -24,6 +24,7 @@
- Fix: [#4055] Sort rides by track type: Sorting rule is not really clear (inconsistent?)
- Fix: [#5400] New Ride window does not focus properly on newly invented ride.
- Fix: [#5009] Ride rating calculations can overflow
- Fix: [#5253] RCT1 park value conversion factor too high
- Fix: [#5489] Sprite index crash for car view on car ride.
- Fix: [#5730] Unable to uncheck 'No money' in the Scenario Editor.
- Fix: Non-invented vehicles can be used via track designs in select-by-track-type mode.

View File

@ -98,6 +98,7 @@ private:
const utf8 * _s4Path = nullptr;
rct1_s4 _s4 = { 0 };
uint8 _gameVersion = 0;
uint8 _parkValueConversionFactor = 0;
// Lists of dynamic object entries
EntryList _rideEntries;
@ -259,9 +260,30 @@ public:
return result;
}
sint32 CorrectRCT1ParkValue(sint32 oldParkValue)
sint32 CorrectRCT1ParkValue(money32 oldParkValue)
{
return oldParkValue * 10;
if (oldParkValue == MONEY32_UNDEFINED)
{
return MONEY32_UNDEFINED;
}
if (_parkValueConversionFactor == 0)
{
if (_s4.park_value != 0)
{
// Use the ratio between the old and new park value to calcute the ratio to
// use for the park value history and the goal.
_parkValueConversionFactor = (calculate_park_value() * 10) / _s4.park_value;
}
else
{
// In new games, the park value isn't set.
_parkValueConversionFactor = 100;
}
}
return (oldParkValue * _parkValueConversionFactor) / 10;
}
private:
@ -1621,7 +1643,7 @@ private:
for (size_t i = 0; i < 128; i++)
{
gCashHistory[i] = _s4.cash_history[i];
gParkValueHistory[i] = _s4.park_value_history[i];
gParkValueHistory[i] = CorrectRCT1ParkValue(_s4.park_value_history[i]);
gWeeklyProfitHistory[i] = _s4.weekly_profit_history[i];
}