summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-10-31 19:39:09 +0100
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commit0f64ee5ce1548d9cda69917f27c5b1a3cb91823d (patch)
tree161f0e6ac300e604de61b8203b5a58279637f9eb /src/ai
parente740c24eb7a90bc771f5976d64d80639ee7576e5 (diff)
downloadopenttd-0f64ee5ce1548d9cda69917f27c5b1a3cb91823d.tar.xz
Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually different parameters, obliviating the need for bit-packing.
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai_gui.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 340b6db95..5996039c9 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -28,6 +28,8 @@
#include "../hotkeys.h"
#include "../core/geometry_func.hpp"
#include "../guitimer_func.h"
+#include "../company_cmd.h"
+#include "../misc_cmd.h"
#include "ai.hpp"
#include "ai_gui.hpp"
@@ -1290,8 +1292,8 @@ struct AIDebugWindow : public Window {
case WID_AID_RELOAD_TOGGLE:
if (ai_debug_company == OWNER_DEITY) break;
/* First kill the company of the AI, then start a new one. This should start the current AI again */
- DoCommandP(CMD_COMPANY_CTRL, 0, CCA_DELETE | ai_debug_company << 16 | CRR_MANUAL << 24, 0);
- DoCommandP(CMD_COMPANY_CTRL, 0, CCA_NEW_AI | ai_debug_company << 16, 0);
+ Command<CMD_COMPANY_CTRL>::Post(0, CCA_DELETE | ai_debug_company << 16 | CRR_MANUAL << 24, 0, {});
+ Command<CMD_COMPANY_CTRL>::Post(0, CCA_NEW_AI | ai_debug_company << 16, 0, {});
break;
case WID_AID_SETTINGS:
@@ -1330,7 +1332,7 @@ struct AIDebugWindow : public Window {
}
if (all_unpaused) {
/* All scripts have been unpaused => unpause the game. */
- DoCommandP(CMD_PAUSE, 0, PM_PAUSED_NORMAL, 0);
+ Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 0, {});
}
}
}
@@ -1379,7 +1381,7 @@ struct AIDebugWindow : public Window {
/* Pause the game. */
if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
- DoCommandP(CMD_PAUSE, 0, PM_PAUSED_NORMAL, 1);
+ Command<CMD_PAUSE>::Post(0, PM_PAUSED_NORMAL, 1, {});
}
/* Highlight row that matched */