diff --git a/src/company_gui.cpp b/src/company_gui.cpp --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -37,6 +37,11 @@ #include "station_func.h" #include "zoom_func.h" #include "sortlist_type.h" +#include "company_cmd.h" +#include "economy_cmd.h" +#include "group_cmd.h" +#include "misc_cmd.h" +#include "object_cmd.h" #include "widgets/company_widget.h" @@ -435,11 +440,11 @@ struct CompanyFinancesWindow : Window { break; case WID_CF_INCREASE_LOAN: // increase loan - DoCommandP(CMD_INCREASE_LOAN, STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY, 0, 0, _ctrl_pressed); + Command::Post(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY, 0, 0, _ctrl_pressed, {}); break; case WID_CF_REPAY_LOAN: // repay loan - DoCommandP(CMD_DECREASE_LOAN, STR_ERROR_CAN_T_REPAY_LOAN, 0, 0, _ctrl_pressed); + Command::Post(STR_ERROR_CAN_T_REPAY_LOAN, 0, 0, _ctrl_pressed, {}); break; case WID_CF_INFRASTRUCTURE: // show infrastructure details @@ -995,12 +1000,12 @@ public: for (LiveryScheme scheme = LS_DEFAULT; scheme < LS_END; scheme++) { /* Changed colour for the selected scheme, or all visible schemes if CTRL is pressed. */ if (HasBit(this->sel, scheme) || (_ctrl_pressed && _livery_class[scheme] == this->livery_class && HasBit(_loaded_newgrf_features.used_liveries, scheme))) { - DoCommandP(CMD_SET_COMPANY_COLOUR, 0, scheme | (widget == WID_SCL_PRI_COL_DROPDOWN ? 0 : 256), index); + Command::Post(0, scheme | (widget == WID_SCL_PRI_COL_DROPDOWN ? 0 : 256), index, {}); } } } else { /* Setting group livery */ - DoCommandP(CMD_SET_GROUP_LIVERY, 0, this->sel, (widget == WID_SCL_PRI_COL_DROPDOWN ? 0 : 256) | (index << 16)); + Command::Post(0, this->sel, (widget == WID_SCL_PRI_COL_DROPDOWN ? 0 : 256) | (index << 16), {}); } } @@ -1581,7 +1586,7 @@ public: /* OK button */ case WID_SCMF_ACCEPT: - DoCommandP(CMD_SET_COMPANY_MANAGER_FACE, 0, 0, this->face); + Command::Post(0, 0, this->face, {}); FALLTHROUGH; /* Cancel button */ @@ -2576,11 +2581,11 @@ struct CompanyWindow : Window break; case WID_C_BUY_SHARE: - DoCommandP(CMD_BUY_SHARE_IN_COMPANY, STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS, (TileIndex)0, this->window_number, 0); + Command::Post(STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS, 0, this->window_number, 0, {}); break; case WID_C_SELL_SHARE: - DoCommandP(CMD_SELL_SHARE_IN_COMPANY, STR_ERROR_CAN_T_SELL_25_SHARE_IN, (TileIndex)0, this->window_number, 0); + Command::Post(STR_ERROR_CAN_T_SELL_25_SHARE_IN, 0, this->window_number, 0, {}); break; case WID_C_COMPANY_PASSWORD: @@ -2613,7 +2618,7 @@ struct CompanyWindow : Window void OnPlaceObject(Point pt, TileIndex tile) override { - if (DoCommandP(CMD_BUILD_OBJECT, STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS, tile, OBJECT_HQ, 0) && !_shift_pressed) { + if (Command::Post(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS, tile, OBJECT_HQ, 0, {}) && !_shift_pressed) { ResetObjectToPlace(); this->RaiseButtons(); } @@ -2635,16 +2640,16 @@ struct CompanyWindow : Window Money money = (Money)(strtoull(str, nullptr, 10) / _currency->rate); uint32 money_c = Clamp(ClampToI32(money), 0, 20000000); // Clamp between 20 million and 0 - DoCommandP(CMD_GIVE_MONEY, STR_ERROR_CAN_T_GIVE_MONEY, 0, money_c, this->window_number); + Command::Post(STR_ERROR_CAN_T_GIVE_MONEY, 0, money_c, this->window_number, {}); break; } case WID_C_PRESIDENT_NAME: - DoCommandP(CMD_RENAME_PRESIDENT, STR_ERROR_CAN_T_CHANGE_PRESIDENT, 0, 0, 0, str); + Command::Post(STR_ERROR_CAN_T_CHANGE_PRESIDENT, 0, 0, 0, str); break; case WID_C_COMPANY_NAME: - DoCommandP(CMD_RENAME_COMPANY, STR_ERROR_CAN_T_CHANGE_COMPANY_NAME, 0, 0, 0, str); + Command::Post(STR_ERROR_CAN_T_CHANGE_COMPANY_NAME, 0, 0, 0, str); break; case WID_C_COMPANY_JOIN: @@ -2771,7 +2776,7 @@ struct BuyCompanyWindow : Window { break; case WID_BC_YES: - DoCommandP(CMD_BUY_COMPANY, STR_ERROR_CAN_T_BUY_COMPANY, (TileIndex)0, this->window_number, 0); + Command::Post(STR_ERROR_CAN_T_BUY_COMPANY, 0, this->window_number, 0, {}); break; } }