mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-11 00:34:27 +00:00
Codechange: pass (uint) money as Money for CmdGiveMoney
This commit is contained in:
parent
4a5a9f57c4
commit
e33b2afd87
@ -1187,7 +1187,7 @@ uint32 CompanyInfrastructure::GetTramTotal() const
|
||||
* @param dest_company the company to transfer the money to
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdGiveMoney(DoCommandFlag flags, uint32 money, CompanyID dest_company)
|
||||
CommandCost CmdGiveMoney(DoCommandFlag flags, Money money, CompanyID dest_company)
|
||||
{
|
||||
if (!_settings_game.economy.give_money) return CMD_ERROR;
|
||||
|
||||
|
@ -18,7 +18,7 @@ enum ClientID : uint32;
|
||||
enum Colours : byte;
|
||||
|
||||
CommandCost CmdCompanyCtrl(DoCommandFlag flags, CompanyCtrlAction cca, CompanyID company_id, CompanyRemoveReason reason, ClientID client_id);
|
||||
CommandCost CmdGiveMoney(DoCommandFlag flags, uint32 money, CompanyID dest_company);
|
||||
CommandCost CmdGiveMoney(DoCommandFlag flags, Money money, CompanyID dest_company);
|
||||
CommandCost CmdRenameCompany(DoCommandFlag flags, const std::string &text);
|
||||
CommandCost CmdRenamePresident(DoCommandFlag flags, const std::string &text);
|
||||
CommandCost CmdSetCompanyManagerFace(DoCommandFlag flags, CompanyManagerFace cmf);
|
||||
|
@ -2646,10 +2646,8 @@ struct CompanyWindow : Window
|
||||
default: NOT_REACHED();
|
||||
|
||||
case WID_C_GIVE_MONEY: {
|
||||
Money money = (Money)(std::strtoull(str, nullptr, 10) / _currency->rate);
|
||||
uint32 money_c = Clamp(ClampToI32(money), 0, 20000000); // Clamp between 20 million and 0
|
||||
|
||||
Command<CMD_GIVE_MONEY>::Post(STR_ERROR_CAN_T_GIVE_MONEY, money_c, (CompanyID)this->window_number);
|
||||
Money money = std::strtoull(str, nullptr, 10) / _currency->rate;
|
||||
Command<CMD_GIVE_MONEY>::Post(STR_ERROR_CAN_T_GIVE_MONEY, money, (CompanyID)this->window_number);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user