From ab69c6c2a0ba9ab36db4a20c0e6db2ea404746bf Mon Sep 17 00:00:00 2001 From: zuu Date: Sat, 21 Sep 2013 13:07:42 +0000 Subject: (svn r25788) -Feature: [Script] Game Scripts can now charge fees and give money to companies --- src/script/api/script_company.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/script/api/script_company.cpp') diff --git a/src/script/api/script_company.cpp b/src/script/api/script_company.cpp index 2f06fd69d..01c2ce6ec 100644 --- a/src/script/api/script_company.cpp +++ b/src/script/api/script_company.cpp @@ -12,6 +12,7 @@ #include "../../stdafx.h" #include "script_company.hpp" #include "script_error.hpp" +#include "script_companymode.hpp" #include "../../company_func.h" #include "../../company_base.h" #include "../../company_manager_face.h" @@ -223,6 +224,17 @@ return GetLoanAmount() == loan; } +/* static */ bool ScriptCompany::ChangeBankBalance(CompanyID company, int32 delta, ExpensesType expenses_type) +{ + EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY); + EnforcePrecondition(false, expenses_type < ::EXPENSES_END); + + company = ResolveCompanyID(company); + EnforcePrecondition(false, ResolveCompanyID(company) != COMPANY_INVALID); + + return ScriptObject::DoCommand(0, (uint32)(delta), company | expenses_type << 8 , CMD_CHANGE_BANK_BALANCE); +} + /* static */ bool ScriptCompany::BuildCompanyHQ(TileIndex tile) { EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY); -- cgit v1.2.3-54-g00ecf