summaryrefslogtreecommitdiff
path: root/src/company_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/company_gui.cpp')
-rw-r--r--src/company_gui.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 7a6e68dea..c2695b910 100644
--- 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<CMD_INCREASE_LOAN>::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<CMD_DECREASE_LOAN>::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<CMD_SET_COMPANY_COLOUR>::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<CMD_SET_GROUP_LIVERY>::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<CMD_SET_COMPANY_MANAGER_FACE>::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<CMD_BUY_SHARE_IN_COMPANY>::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<CMD_SELL_SHARE_IN_COMPANY>::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<CMD_BUILD_OBJECT>::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<CMD_GIVE_MONEY>::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<CMD_RENAME_PRESIDENT>::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<CMD_RENAME_COMPANY>::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<CMD_BUY_COMPANY>::Post(STR_ERROR_CAN_T_BUY_COMPANY, 0, this->window_number, 0, {});
break;
}
}