mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 05:23:04 +01:00
Move .bankLoanInterestRate into ParkData struct
This commit is contained in:
@@ -1486,10 +1486,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
Invalidate();
|
||||
break;
|
||||
case WIDX_INTEREST_RATE_INCREASE:
|
||||
if (gameState.bankLoanInterestRate < MaxBankLoanInterestRate)
|
||||
if (gameState.park.bankLoanInterestRate < MaxBankLoanInterestRate)
|
||||
{
|
||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||
ScenarioSetSetting::AnnualInterestRate, gameState.bankLoanInterestRate + 1);
|
||||
ScenarioSetSetting::AnnualInterestRate, gameState.park.bankLoanInterestRate + 1);
|
||||
GameActions::Execute(&scenarioSetSetting);
|
||||
}
|
||||
else
|
||||
@@ -1499,9 +1499,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
Invalidate();
|
||||
break;
|
||||
case WIDX_INTEREST_RATE_DECREASE:
|
||||
if (gameState.bankLoanInterestRate > 0)
|
||||
if (gameState.park.bankLoanInterestRate > 0)
|
||||
{
|
||||
auto interest = std::min<uint8_t>(MaxBankLoanInterestRate, gameState.bankLoanInterestRate - 1);
|
||||
auto interest = std::min<uint8_t>(MaxBankLoanInterestRate, gameState.park.bankLoanInterestRate - 1);
|
||||
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::AnnualInterestRate, interest);
|
||||
GameActions::Execute(&scenarioSetSetting);
|
||||
}
|
||||
@@ -1718,7 +1718,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto ft = Formatter();
|
||||
ft.Add<int16_t>(
|
||||
std::clamp<int16_t>(static_cast<int16_t>(gameState.bankLoanInterestRate), INT16_MIN, INT16_MAX));
|
||||
std::clamp<int16_t>(static_cast<int16_t>(gameState.park.bankLoanInterestRate), INT16_MIN, INT16_MAX));
|
||||
auto colour = !IsWidgetDisabled(WIDX_INTEREST_RATE) ? wColour2 : wColour2.withFlag(ColourFlag::inset, true);
|
||||
DrawTextBasic(rt, screenCoords, STR_PERCENT_FORMAT_LABEL, ft, colour);
|
||||
}
|
||||
|
||||
@@ -624,7 +624,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (!(gameState.park.Flags & PARK_FLAGS_RCT1_INTEREST))
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(gameState.bankLoanInterestRate);
|
||||
ft.Add<uint16_t>(gameState.park.bankLoanInterestRate);
|
||||
DrawTextBasic(
|
||||
rt, windowPos + ScreenCoordsXY{ 167, titleBarBottom + 265 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft);
|
||||
}
|
||||
|
||||
@@ -330,7 +330,8 @@ namespace OpenRCT2::Editor
|
||||
|
||||
gameState.park.maxBankLoan = std::clamp<money64>(gameState.park.maxBankLoan, 0.00_GBP, 5000000.00_GBP);
|
||||
|
||||
gameState.bankLoanInterestRate = std::clamp<uint8_t>(gameState.bankLoanInterestRate, 5, MaxBankLoanInterestRate);
|
||||
gameState.park.bankLoanInterestRate = std::clamp<uint8_t>(
|
||||
gameState.park.bankLoanInterestRate, 5, MaxBankLoanInterestRate);
|
||||
}
|
||||
|
||||
ClimateReset();
|
||||
|
||||
@@ -57,9 +57,8 @@ namespace OpenRCT2
|
||||
uint16_t scenarioParkRatingWarningDays;
|
||||
money64 scenarioCompletedCompanyValue;
|
||||
money64 scenarioCompanyValueRecord;
|
||||
|
||||
uint8_t bankLoanInterestRate;
|
||||
random_engine_t scenarioRand;
|
||||
|
||||
TileCoordsXY mapSize;
|
||||
money64 landPrice;
|
||||
money64 constructionRightsPrice;
|
||||
|
||||
@@ -99,7 +99,7 @@ GameActions::Result ScenarioSetSettingAction::Execute() const
|
||||
windowMgr->InvalidateByClass(WindowClass::Finances);
|
||||
break;
|
||||
case ScenarioSetSetting::AnnualInterestRate:
|
||||
gameState.bankLoanInterestRate = std::clamp<uint8_t>(_value, 0, MaxBankLoanInterestRate);
|
||||
gameState.park.bankLoanInterestRate = std::clamp<uint8_t>(_value, 0, MaxBankLoanInterestRate);
|
||||
windowMgr->InvalidateByClass(WindowClass::Finances);
|
||||
break;
|
||||
case ScenarioSetSetting::ForbidMarketingCampaigns:
|
||||
|
||||
@@ -142,7 +142,7 @@ void FinancePayInterest()
|
||||
// This variable uses the 64-bit type as the computation below can involve multiplying very large numbers
|
||||
// that will overflow money64 if the loan is greater than (1 << 31) / (5 * current_interest_rate)
|
||||
const money64 current_loan = gameState.park.bankLoan;
|
||||
const auto current_interest_rate = gameState.bankLoanInterestRate;
|
||||
const auto current_interest_rate = gameState.park.bankLoanInterestRate;
|
||||
const money64 interest_to_pay = (gameState.park.Flags & PARK_FLAGS_RCT1_INTEREST)
|
||||
? (current_loan / 2400)
|
||||
: (current_loan * 5 * current_interest_rate) >> 14;
|
||||
@@ -228,7 +228,7 @@ void FinanceInit()
|
||||
gameState.park.bankLoan = 10000.00_GBP;
|
||||
gameState.park.maxBankLoan = 20000.00_GBP;
|
||||
|
||||
gameState.bankLoanInterestRate = 10;
|
||||
gameState.park.bankLoanInterestRate = 10;
|
||||
gameState.park.Value = 0;
|
||||
gameState.park.companyValue = 0;
|
||||
gameState.park.historicalProfit = 0;
|
||||
|
||||
@@ -896,7 +896,7 @@ namespace OpenRCT2
|
||||
cs.ReadWrite(gameState.park.cash);
|
||||
cs.ReadWrite(gameState.park.bankLoan);
|
||||
cs.ReadWrite(gameState.park.maxBankLoan);
|
||||
cs.ReadWrite(gameState.bankLoanInterestRate);
|
||||
cs.ReadWrite(gameState.park.bankLoanInterestRate);
|
||||
cs.ReadWrite(gameState.park.Flags);
|
||||
if (version <= 18)
|
||||
{
|
||||
|
||||
@@ -1508,7 +1508,7 @@ namespace OpenRCT2::RCT1
|
||||
gameState.park.bankLoan = ToMoney64(_s4.Loan);
|
||||
gameState.park.maxBankLoan = ToMoney64(_s4.MaxLoan);
|
||||
// It's more like 1.33%, but we can only use integers. Can be fixed once we have our own save format.
|
||||
gameState.bankLoanInterestRate = 1;
|
||||
gameState.park.bankLoanInterestRate = 1;
|
||||
gameState.initialCash = ToMoney64(_s4.Cash);
|
||||
|
||||
gameState.park.companyValue = ToMoney64(_s4.CompanyValue);
|
||||
|
||||
@@ -535,7 +535,7 @@ namespace OpenRCT2::RCT2
|
||||
// rct1_water_colour
|
||||
// Pad01358842
|
||||
ImportResearchList(gameState);
|
||||
gameState.bankLoanInterestRate = _s6.CurrentInterestRate;
|
||||
gameState.park.bankLoanInterestRate = _s6.CurrentInterestRate;
|
||||
// Pad0135934B
|
||||
// Preserve compatibility with vanilla RCT2's save format.
|
||||
gameState.park.Entrances.clear();
|
||||
|
||||
@@ -95,6 +95,7 @@ namespace OpenRCT2::Park
|
||||
|
||||
money64 bankLoan;
|
||||
money64 maxBankLoan;
|
||||
uint8_t bankLoanInterestRate;
|
||||
|
||||
uint64_t samePriceThroughoutPark{};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user