1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

Codechange: Remove unnecessary 'return_cmd_error` macro. (#13160)

This macro is a leftover from when errors used to be packed into a single int32_t.

`return CommandCost` is clearer, and doesn't need a macro.
This commit is contained in:
Peter Nelson
2024-12-08 18:02:30 +00:00
committed by GitHub
parent 369e8a6fe9
commit 1e77fd0b61
27 changed files with 276 additions and 286 deletions

View File

@@ -42,7 +42,7 @@ CommandCost CmdIncreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount)
Money max_loan = c->GetMaxLoan();
if (c->current_loan >= max_loan) {
SetDParam(0, max_loan);
return_cmd_error(STR_ERROR_MAXIMUM_PERMITTED_LOAN);
return CommandCost(STR_ERROR_MAXIMUM_PERMITTED_LOAN);
}
Money loan;
@@ -87,7 +87,7 @@ CommandCost CmdDecreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount)
{
Company *c = Company::Get(_current_company);
if (c->current_loan == 0) return_cmd_error(STR_ERROR_LOAN_ALREADY_REPAYED);
if (c->current_loan == 0) return CommandCost(STR_ERROR_LOAN_ALREADY_REPAYED);
Money loan;
switch (cmd) {
@@ -107,7 +107,7 @@ CommandCost CmdDecreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount)
if (GetAvailableMoneyForCommand() < loan) {
SetDParam(0, loan);
return_cmd_error(STR_ERROR_CURRENCY_REQUIRED);
return CommandCost(STR_ERROR_CURRENCY_REQUIRED);
}
if (flags & DC_EXEC) {