diff options
author | frosch <frosch@openttd.org> | 2010-06-05 11:51:34 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-06-05 11:51:34 +0000 |
commit | 406c2a986571ce594f491c0fde225b89f14ac8c3 (patch) | |
tree | 7546ada54459345288e3a718b06887c93129c655 | |
parent | e7f70987a4a616de22ffebcfd1d128d88d0db9a2 (diff) | |
download | openttd-406c2a986571ce594f491c0fde225b89f14ac8c3.tar.xz |
(svn r19930) -Codechange: Deduplicate magic command parameter casts. (rubidium)
-rw-r--r-- | src/misc_cmd.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index 181b8c190..20a110375 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -222,14 +222,15 @@ CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 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((CompanyID)p2)) return CMD_ERROR; + if (!_networking || !Company::IsValidID(dest_company)) return CMD_ERROR; if (flags & DC_EXEC) { /* Add money to company */ - Backup<CompanyByte> cur_company(_current_company, (CompanyID)p2); + Backup<CompanyByte> cur_company(_current_company, dest_company); SubtractMoneyFromCompany(CommandCost(EXPENSES_OTHER, -amount.GetCost())); cur_company.Restore(); } |