diff options
Diffstat (limited to 'src/misc_cmd.cpp')
-rw-r--r-- | src/misc_cmd.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index c1c81535a..42f800351 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -236,38 +236,3 @@ CommandCost CmdChangeBankBalance(TileIndex tile, DoCommandFlag flags, uint32 p1, CommandCost zero_cost(expenses_type, 0); return zero_cost; } - -/** - * Transfer funds (money) from one company to another. - * To prevent abuse in multiplayer games you can only send money to other - * companies if you have paid off your loan (either explicitly, or implicitly - * given the fact that you have more money than loan). - * @param tile unused - * @param flags operation to perform - * @param p1 the amount of money to transfer; max 20.000.000 - * @param p2 the company to transfer the money to - * @param text unused - * @return the cost of this operation or an error - */ -CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) -{ - if (!_settings_game.economy.give_money) return CMD_ERROR; - - const Company *c = Company::Get(_current_company); - CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL)); - CompanyID dest_company = (CompanyID)p2; - - /* You can only transfer funds that is in excess of your loan */ - if (c->money - c->current_loan < amount.GetCost() || amount.GetCost() < 0) return CMD_ERROR; - if (!_networking || !Company::IsValidID(dest_company)) return CMD_ERROR; - - if (flags & DC_EXEC) { - /* Add money to company */ - Backup<CompanyID> cur_company(_current_company, dest_company, FILE_LINE); - SubtractMoneyFromCompany(CommandCost(EXPENSES_OTHER, -amount.GetCost())); - cur_company.Restore(); - } - - /* Subtract money from local-company */ - return amount; -} |