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