Feature: Add tile parameter for GSCompany.ChangeBankBalance to show text effect if needed (#8573)

This commit is contained in:
Pavel Stupnikov
2021-01-22 12:28:26 +03:00
committed by GitHub
parent 3345d54ad9
commit 4b42ecb0f6
13 changed files with 80 additions and 4 deletions

View File

@@ -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. */