Add AI/GS method to get annual expense category value

See: #425
This commit is contained in:
Jonathan G Rennison
2022-09-16 21:26:25 +01:00
parent 2ff11017dc
commit 9c255850a5
3 changed files with 44 additions and 1 deletions

View File

@@ -167,6 +167,17 @@
return ::Company::Get(company)->old_economy[quarter - 1].company_value;
}
/* static */ Money ScriptCompany::GetAnnualExpenseValue(CompanyID company, uint32 year_offset, ExpensesType expenses_type)
{
EnforcePrecondition(false, expenses_type < (ExpensesType)::EXPENSES_END);
EnforcePrecondition(false, year_offset <= 2);
company = ResolveCompanyID(company);
if (company == COMPANY_INVALID) return -1;
return ::Company::Get(company)->yearly_expenses[year_offset][expenses_type];
}
/* static */ Money ScriptCompany::GetBankBalance(ScriptCompany::CompanyID company)
{