parent
a1371819f5
commit
fb9e14e24f
2 changed files with 8 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
20.05+ (???)
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
- Fix: [#488] Repeated clicking may lead to a negative loan.
|
||||||
|
|
||||||
20.05 (2020-05-24)
|
20.05 (2020-05-24)
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
- Feature: [#77] Add "Exit OpenLoco" to the main menu.
|
- Feature: [#77] Add "Exit OpenLoco" to the main menu.
|
||||||
|
|
|
@ -1894,8 +1894,8 @@ namespace openloco::ui::windows::CompanyWindow
|
||||||
|
|
||||||
case widx::loan_decrease:
|
case widx::loan_decrease:
|
||||||
{
|
{
|
||||||
currency32_t newLoan = companymgr::get(self->number)->current_loan;
|
auto company = companymgr::get(self->number);
|
||||||
if (newLoan == 0)
|
if (company->current_loan == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
currency32_t stepSize{};
|
currency32_t stepSize{};
|
||||||
|
@ -1906,7 +1906,8 @@ namespace openloco::ui::windows::CompanyWindow
|
||||||
else if (*_clickRepeatTicks >= 200)
|
else if (*_clickRepeatTicks >= 200)
|
||||||
stepSize = 100000;
|
stepSize = 100000;
|
||||||
|
|
||||||
newLoan -= stepSize;
|
auto newLoan = std::max<currency32_t>(0, company->current_loan - stepSize);
|
||||||
|
|
||||||
gGameCommandErrorTitle = string_ids::cant_pay_back_loan;
|
gGameCommandErrorTitle = string_ids::cant_pay_back_loan;
|
||||||
game_commands::do_9(newLoan);
|
game_commands::do_9(newLoan);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue