Update to 13.0-RC2

This commit is contained in:
dP
2023-02-03 15:05:53 +04:00
parent 59c991fa52
commit ebf0794b1c
157 changed files with 4980 additions and 3101 deletions

View File

@@ -60,8 +60,10 @@ CommandCost CmdIncreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount)
break;
}
/* Overflow protection */
if (c->money + c->current_loan + loan < c->money) return CMD_ERROR;
/* In case adding the loan triggers the overflow protection of Money,
* we would essentially be losing money as taking and repaying the loan
* immediately would not get us back to the same bank balance anymore. */
if (c->money > Money::max() - loan) return CMD_ERROR;
if (flags & DC_EXEC) {
c->money += loan;