diff options
-rw-r--r-- | bin/game/compat_1.10.nut | 7 | ||||
-rw-r--r-- | bin/game/compat_1.2.nut | 7 | ||||
-rw-r--r-- | bin/game/compat_1.3.nut | 7 | ||||
-rw-r--r-- | bin/game/compat_1.4.nut | 8 | ||||
-rw-r--r-- | bin/game/compat_1.5.nut | 7 | ||||
-rw-r--r-- | bin/game/compat_1.6.nut | 7 | ||||
-rw-r--r-- | bin/game/compat_1.7.nut | 7 | ||||
-rw-r--r-- | bin/game/compat_1.8.nut | 7 | ||||
-rw-r--r-- | bin/game/compat_1.9.nut | 7 | ||||
-rw-r--r-- | src/misc_cmd.cpp | 8 | ||||
-rw-r--r-- | src/script/api/game_changelog.hpp | 3 | ||||
-rw-r--r-- | src/script/api/script_company.cpp | 6 | ||||
-rw-r--r-- | src/script/api/script_company.hpp | 3 |
13 files changed, 80 insertions, 4 deletions
diff --git a/bin/game/compat_1.10.nut b/bin/game/compat_1.10.nut index 1c85766c0..92cef84c5 100644 --- a/bin/game/compat_1.10.nut +++ b/bin/game/compat_1.10.nut @@ -6,3 +6,10 @@ */ GSLog.Info("1.10 API compatibility in effect."); + +/* 1.11 adds a tile parameter. */ +GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance; +GSCompany.ChangeBankBalance <- function(company, delta, expenses_type) +{ + return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID); +} diff --git a/bin/game/compat_1.2.nut b/bin/game/compat_1.2.nut index c042e988b..5fb29efed 100644 --- a/bin/game/compat_1.2.nut +++ b/bin/game/compat_1.2.nut @@ -28,3 +28,10 @@ GSBridge.GetName <- function(bridge_id) { return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL); } + +/* 1.11 adds a tile parameter. */ +GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance; +GSCompany.ChangeBankBalance <- function(company, delta, expenses_type) +{ + return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID); +} diff --git a/bin/game/compat_1.3.nut b/bin/game/compat_1.3.nut index 161f4fd0a..7546e54c6 100644 --- a/bin/game/compat_1.3.nut +++ b/bin/game/compat_1.3.nut @@ -28,3 +28,10 @@ GSBridge.GetName <- function(bridge_id) { return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL); } + +/* 1.11 adds a tile parameter. */ +GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance; +GSCompany.ChangeBankBalance <- function(company, delta, expenses_type) +{ + return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID); +} diff --git a/bin/game/compat_1.4.nut b/bin/game/compat_1.4.nut index 0ebb85067..c90b3e550 100644 --- a/bin/game/compat_1.4.nut +++ b/bin/game/compat_1.4.nut @@ -20,3 +20,11 @@ GSBridge.GetName <- function(bridge_id) { return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL); } + +/* 1.11 adds a tile parameter. */ +GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance; +GSCompany.ChangeBankBalance <- function(company, delta, expenses_type) +{ + return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID); +} + diff --git a/bin/game/compat_1.5.nut b/bin/game/compat_1.5.nut index 86283cc0d..0c62e5646 100644 --- a/bin/game/compat_1.5.nut +++ b/bin/game/compat_1.5.nut @@ -13,3 +13,10 @@ GSBridge.GetName <- function(bridge_id) { return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL); } + +/* 1.11 adds a tile parameter. */ +GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance; +GSCompany.ChangeBankBalance <- function(company, delta, expenses_type) +{ + return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID); +} diff --git a/bin/game/compat_1.6.nut b/bin/game/compat_1.6.nut index 4a091b81e..198b863a7 100644 --- a/bin/game/compat_1.6.nut +++ b/bin/game/compat_1.6.nut @@ -13,3 +13,10 @@ GSBridge.GetName <- function(bridge_id) { return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL); } + +/* 1.11 adds a tile parameter. */ +GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance; +GSCompany.ChangeBankBalance <- function(company, delta, expenses_type) +{ + return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID); +} diff --git a/bin/game/compat_1.7.nut b/bin/game/compat_1.7.nut index febd335c3..76dc42435 100644 --- a/bin/game/compat_1.7.nut +++ b/bin/game/compat_1.7.nut @@ -13,3 +13,10 @@ GSBridge.GetName <- function(bridge_id) { return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL); } + +/* 1.11 adds a tile parameter. */ +GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance; +GSCompany.ChangeBankBalance <- function(company, delta, expenses_type) +{ + return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID); +} diff --git a/bin/game/compat_1.8.nut b/bin/game/compat_1.8.nut index bd33b79f0..b9d27458a 100644 --- a/bin/game/compat_1.8.nut +++ b/bin/game/compat_1.8.nut @@ -13,3 +13,10 @@ GSBridge.GetName <- function(bridge_id) { return GSBridge._GetName(bridge_id, GSVehicle.VT_RAIL); } + +/* 1.11 adds a tile parameter. */ +GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance; +GSCompany.ChangeBankBalance <- function(company, delta, expenses_type) +{ + return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID); +} diff --git a/bin/game/compat_1.9.nut b/bin/game/compat_1.9.nut index ab9ffbcca..32eec114a 100644 --- a/bin/game/compat_1.9.nut +++ b/bin/game/compat_1.9.nut @@ -6,3 +6,10 @@ */ GSLog.Info("1.9 API compatibility in effect."); + +/* 1.11 adds a tile parameter. */ +GSCompany._ChangeBankBalance <- GSCompany.ChangeBankBalance; +GSCompany.ChangeBankBalance <- function(company, delta, expenses_type) +{ + return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID); +} diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index c943a2027..2d1bbdf7a 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -19,6 +19,8 @@ #include "company_func.h" #include "company_gui.h" #include "company_base.h" +#include "tile_map.h" +#include "texteff.hpp" #include "core/backup_type.hpp" #include "table/strings.h" @@ -207,7 +209,7 @@ CommandCost CmdMoneyCheat(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 /** * Change the bank bank balance of a company by inserting or removing money without affecting the loan. - * @param tile unused + * @param tile tile to show text effect on (if not 0) * @param flags operation to perform * @param p1 the amount of money to receive (if positive), or spend (if negative) * @param p2 (bit 0-7) - the company ID. @@ -230,6 +232,10 @@ CommandCost CmdChangeBankBalance(TileIndex tile, DoCommandFlag flags, uint32 p1, Backup<CompanyID> cur_company(_current_company, company, FILE_LINE); SubtractMoneyFromCompany(CommandCost(expenses_type, -delta)); cur_company.Restore(); + + if (tile != 0) { + ShowCostOrIncomeAnimation(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, GetTilePixelZ(tile), -delta); + } } /* This command doesn't cost anything for deity. */ diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp index cbb862f1c..82f0c0523 100644 --- a/src/script/api/game_changelog.hpp +++ b/src/script/api/game_changelog.hpp @@ -35,6 +35,9 @@ * \li GSStoryPage::MakeVehicleButtonReference * \li GSPriorityQueue * + * Other changes: + * \li GSCompany::ChangeBankBalance takes one extra parameter to refer to a location to show text effect on + * * \b 1.10.0 * * API additions: diff --git a/src/script/api/script_company.cpp b/src/script/api/script_company.cpp index 93bba6332..20f1b3f7a 100644 --- a/src/script/api/script_company.cpp +++ b/src/script/api/script_company.cpp @@ -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) diff --git a/src/script/api/script_company.hpp b/src/script/api/script_company.hpp index ea2f0cdd1..635b6fdee 100644 --- a/src/script/api/script_company.hpp +++ b/src/script/api/script_company.hpp @@ -242,6 +242,7 @@ public: * @param company The company to change the bank balance of. * @param delta Amount of money to give or take from the bank balance. A positive value adds money to the bank balance. * @param expenses_type The account in the finances window that will register the cost. + * @param tile The tile to show text effect on or ScriptMap::TILE_INVALID * @return True, if the bank balance was changed. * @game @pre No ScriptCompanyMode active in scope. * @pre ResolveCompanyID(company) != COMPANY_INVALID. @@ -250,7 +251,7 @@ public: * @note You need to create your own news message to inform about costs/gifts that you create using this command. * @api -ai */ - static bool ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type); + static bool ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type, TileIndex tile); /** * Get the income of the company in the given quarter. |