summaryrefslogtreecommitdiff
path: root/src/script/api/script_company.cpp
diff options
context:
space:
mode:
authorzuu <zuu@openttd.org>2013-09-21 13:07:42 +0000
committerzuu <zuu@openttd.org>2013-09-21 13:07:42 +0000
commitab69c6c2a0ba9ab36db4a20c0e6db2ea404746bf (patch)
treecadbe91c284755b63ace0e8a146bdbbb48cb2fdc /src/script/api/script_company.cpp
parent01dea4ec37e79b2db08bbeb99727592b01eeb492 (diff)
downloadopenttd-ab69c6c2a0ba9ab36db4a20c0e6db2ea404746bf.tar.xz
(svn r25788) -Feature: [Script] Game Scripts can now charge fees and give money to companies
Diffstat (limited to 'src/script/api/script_company.cpp')
-rw-r--r--src/script/api/script_company.cpp12
1 files changed, 12 insertions, 0 deletions
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);