summaryrefslogtreecommitdiff
path: root/src/rail_gui.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-10-30 01:31:46 +0200
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commite740c24eb7a90bc771f5976d64d80639ee7576e5 (patch)
treeb3c8f0c87419cb11c106ba1cb58d6ae0648beef4 /src/rail_gui.cpp
parentc88b104ec662ea80bec89f58aa7ad9d0baac7704 (diff)
downloadopenttd-e740c24eb7a90bc771f5976d64d80639ee7576e5.tar.xz
Codechange: Template DoCommand 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/rail_gui.cpp')
-rw-r--r--src/rail_gui.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 76d51ccb2..f88352f9e 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -37,6 +37,7 @@
#include "stringfilter_type.h"
#include "string_func.h"
#include "station_cmd.h"
+#include "tunnelbridge_cmd.h"
#include "waypoint_cmd.h"
#include "station_map.h"
@@ -202,7 +203,7 @@ static void PlaceRail_Station(TileIndex tile)
auto proc = [=](bool test, StationID to_join) -> bool {
if (test) {
- return DoCommand(CommandFlagsToDCFlags(GetCommandFlags(CMD_BUILD_RAIL_STATION)), CMD_BUILD_RAIL_STATION, tile, p1, p2).Succeeded();
+ return Command<CMD_BUILD_RAIL_STATION>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_RAIL_STATION>()), tile, p1, p2, {}).Succeeded();
} else {
uint32 p2_final = p2;
if (to_join != INVALID_STATION) SB(p2_final, 16, 16, to_join);
@@ -738,7 +739,7 @@ struct BuildRailToolbarWindow : Window {
auto proc = [=](bool test, StationID to_join) -> bool {
if (test) {
- return DoCommand(CommandFlagsToDCFlags(GetCommandFlags(CMD_BUILD_RAIL_WAYPOINT)), CMD_BUILD_RAIL_WAYPOINT, ta.tile, p1, p2).Succeeded();
+ return Command<CMD_BUILD_RAIL_WAYPOINT>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_RAIL_WAYPOINT>()), ta.tile, p1, p2, {}).Succeeded();
} else {
uint32 p2_final = p2;
if (to_join != INVALID_STATION) SB(p2_final, 16, 16, to_join);
@@ -773,7 +774,7 @@ struct BuildRailToolbarWindow : Window {
void OnPlacePresize(Point pt, TileIndex tile) override
{
- DoCommand(DC_AUTO, CMD_BUILD_TUNNEL, tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0);
+ Command<CMD_BUILD_TUNNEL>::Do(DC_AUTO, tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0, {});
VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile);
}
@@ -907,7 +908,7 @@ static void HandleStationPlacement(TileIndex start, TileIndex end)
auto proc = [=](bool test, StationID to_join) -> bool {
if (test) {
- return DoCommand(CommandFlagsToDCFlags(GetCommandFlags(CMD_BUILD_RAIL_STATION)), CMD_BUILD_RAIL_STATION, ta.tile, p1, p2).Succeeded();
+ return Command<CMD_BUILD_RAIL_STATION>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_RAIL_STATION>()), ta.tile, p1, p2, {}).Succeeded();
} else {
uint32 p2_final = p2;
if (to_join != INVALID_STATION) SB(p2_final, 16, 16, to_join);