1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-28 00:49:11 +00:00

Feature: Add tile parameter for GSCompany.ChangeBankBalance to show text effect if needed (#8573)

This commit is contained in:
Pavel Stupnikov
2021-01-22 12:28:26 +03:00
committed by GitHub
parent 3345d54ad9
commit 4b42ecb0f6
13 changed files with 80 additions and 4 deletions

View File

@@ -226,17 +226,19 @@
return GetLoanAmount() == loan;
}
/* static */ bool ScriptCompany::ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type)
/* static */ bool ScriptCompany::ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type, TileIndex tile)
{
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
EnforcePrecondition(false, expenses_type < (ExpensesType)::EXPENSES_END);
EnforcePrecondition(false, (int64)delta >= INT32_MIN);
EnforcePrecondition(false, (int64)delta <= INT32_MAX);
EnforcePrecondition(false, tile == INVALID_TILE || ::IsValidTile(tile));
company = ResolveCompanyID(company);
EnforcePrecondition(false, company != COMPANY_INVALID);
return ScriptObject::DoCommand(0, (uint32)(delta), company | expenses_type << 8 , CMD_CHANGE_BANK_BALANCE);
/* Network commands only allow 0 to indicate invalid tiles, not INVALID_TILE */
return ScriptObject::DoCommand(tile == INVALID_TILE ? 0 : tile , (uint32)(delta), company | expenses_type << 8 , CMD_CHANGE_BANK_BALANCE);
}
/* static */ bool ScriptCompany::BuildCompanyHQ(TileIndex tile)