Changeset - r27269:671153a97afa
[Not reviewed]
master
0 3 0
Rubidium - 19 months ago 2023-05-05 09:37:17
rubidium@openttd.org
Codechange: pass (uint) money as Money for CmdGiveMoney
3 files changed with 4 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/company_cmd.cpp
Show inline comments
 
@@ -1187,7 +1187,7 @@ uint32 CompanyInfrastructure::GetTramTot
 
 * @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;
 

	
src/company_cmd.h
Show inline comments
 
@@ -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);
src/company_gui.cpp
Show inline comments
 
@@ -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;
 
			}
 

	
0 comments (0 inline, 0 general)