mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
* Small refactor of ParkSetLoanAction * Fix #19475: Cannot increase loan when in debt
This commit is contained in:
parent
d18de99579
commit
0674d9527c
2 changed files with 7 additions and 6 deletions
|
@ -53,6 +53,7 @@
|
|||
- Fix: [#19379] “No platforms” station style shows platforms on the Junior Roller Coaster.
|
||||
- Fix: [#19380] Startup crash when no sequences are installed and random sequences are enabled.
|
||||
- Fix: [#19391] String corruption caused by an improper buffer handling in ‘GfxWrapString’.
|
||||
- Fix: [#19475] Cannot increase loan when more than £1000 in debt.
|
||||
|
||||
0.4.3 (2022-12-14)
|
||||
------------------------------------------------------------------------
|
||||
|
|
|
@ -40,19 +40,19 @@ void ParkSetLoanAction::Serialise(DataSerialiser& stream)
|
|||
|
||||
GameActions::Result ParkSetLoanAction::Query() const
|
||||
{
|
||||
auto currentLoan = gBankLoan;
|
||||
auto loanDifference = currentLoan - _value;
|
||||
if (_value > currentLoan && _value > gMaxBankLoan)
|
||||
if (_value > gBankLoan && _value > gMaxBankLoan)
|
||||
{
|
||||
return GameActions::Result(
|
||||
GameActions::Status::Disallowed, STR_CANT_BORROW_ANY_MORE_MONEY, STR_BANK_REFUSES_TO_INCREASE_LOAN);
|
||||
}
|
||||
// FIXME: use money64 literal once it is implemented
|
||||
if (_value < currentLoan && _value < 0)
|
||||
if (_value < gBankLoan && _value < 0.00_GBP)
|
||||
{
|
||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_PAY_BACK_LOAN, STR_LOAN_CANT_BE_NEGATIVE);
|
||||
}
|
||||
if (loanDifference > gCash)
|
||||
// The “isPayingBack” check is needed to allow increasing the loan when the player is in debt.
|
||||
const auto isPayingBack = gBankLoan > _value;
|
||||
const auto amountToPayBack = gBankLoan - _value;
|
||||
if (isPayingBack && amountToPayBack > gCash)
|
||||
{
|
||||
return GameActions::Result(
|
||||
GameActions::Status::InsufficientFunds, STR_CANT_PAY_BACK_LOAN, STR_NOT_ENOUGH_CASH_AVAILABLE);
|
||||
|
|
Loading…
Reference in a new issue