summaryrefslogtreecommitdiff
path: root/src/misc_cmd.cpp
diff options
context:
space:
mode:
authorPavel Stupnikov <dp@dpointer.org>2021-01-22 12:28:26 +0300
committerGitHub <noreply@github.com>2021-01-22 10:28:26 +0100
commit4b42ecb0f64c0044786412c15fb31b3705016375 (patch)
tree316d7c36b2522d2b7022b259f3165fbb6b0d109b /src/misc_cmd.cpp
parent3345d54ad932773b74171a7ae6c00a3ec3c8556b (diff)
downloadopenttd-4b42ecb0f64c0044786412c15fb31b3705016375.tar.xz
Feature: Add tile parameter for GSCompany.ChangeBankBalance to show text effect if needed (#8573)
Diffstat (limited to 'src/misc_cmd.cpp')
-rw-r--r--src/misc_cmd.cpp8
1 files changed, 7 insertions, 1 deletions
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. */