summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-10-10 02:35:06 +0200
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commit123c7f99c342aa9eb7ca505f0b49257fc8eee7ff (patch)
treeeaa3f1c377393e03263a974b7080eacc6f80ae77
parent7048e1522f7095e7c716c2488d78711ab6ed912c (diff)
downloadopenttd-123c7f99c342aa9eb7ca505f0b49257fc8eee7ff.tar.xz
Codechange: Move command callback declarations to the cmd header files.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/airport_cmd.h17
-rw-r--r--src/airport_gui.cpp1
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/command_func.h56
-rw-r--r--src/depot_cmd.h2
-rw-r--r--src/dock_cmd.h18
-rw-r--r--src/dock_gui.cpp2
-rw-r--r--src/group_cmd.h3
-rw-r--r--src/group_gui.cpp1
-rw-r--r--src/industry_cmd.h2
-rw-r--r--src/network/network_command.cpp13
-rw-r--r--src/object_gui.cpp1
-rw-r--r--src/rail_cmd.h5
-rw-r--r--src/road_cmd.h5
-rw-r--r--src/script/CMakeLists.txt1
-rw-r--r--src/script/script_cmd.h18
-rw-r--r--src/terraform_cmd.h4
-rw-r--r--src/terraform_gui.cpp2
-rw-r--r--src/town_cmd.h3
-rw-r--r--src/train_cmd.h2
-rw-r--r--src/tunnelbridge_cmd.h2
-rw-r--r--src/vehicle_cmd.h3
-rw-r--r--src/vehicle_gui.cpp1
24 files changed, 110 insertions, 56 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6950e3275..dd3a6c2f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -42,6 +42,7 @@ add_files(
aircraft_gui.cpp
airport.cpp
airport.h
+ airport_cmd.h
airport_gui.cpp
animated_tile.cpp
animated_tile_func.h
@@ -131,6 +132,7 @@ add_files(
direction_type.h
disaster_vehicle.cpp
disaster_vehicle.h
+ dock_cmd.h
dock_gui.cpp
driver.cpp
driver.h
diff --git a/src/airport_cmd.h b/src/airport_cmd.h
new file mode 100644
index 000000000..2e27057d8
--- /dev/null
+++ b/src/airport_cmd.h
@@ -0,0 +1,17 @@
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file airport_cmd.h Command definitions related to airports. */
+
+#ifndef AIRPORT_CMD_H
+#define AIRPORT_CMD_H
+
+#include "command_type.h"
+
+CommandCallback CcBuildAirport;
+
+#endif /* AIRPORT_CMD_H */
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index a031c450c..ca3d8aa71 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -26,6 +26,7 @@
#include "hotkeys.h"
#include "vehicle_func.h"
#include "gui.h"
+#include "airport_cmd.h"
#include "widgets/airport_widget.h"
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index b1136ec30..34d771090 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -30,6 +30,8 @@
#include "cargotype.h"
#include "core/geometry_func.hpp"
#include "autoreplace_func.h"
+#include "train_cmd.h"
+#include "vehicle_cmd.h"
#include "widgets/build_vehicle_widget.h"
diff --git a/src/command_func.h b/src/command_func.h
index 15c88ea03..03bfc73f1 100644
--- a/src/command_func.h
+++ b/src/command_func.h
@@ -67,60 +67,4 @@ static inline DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
return flags;
}
-/*** All command callbacks that exist ***/
-
-/* ai/ai_instance.cpp */
-CommandCallback CcAI;
-
-/* airport_gui.cpp */
-CommandCallback CcBuildAirport;
-
-/* bridge_gui.cpp */
-CommandCallback CcBuildBridge;
-
-/* dock_gui.cpp */
-CommandCallback CcBuildDocks;
-CommandCallback CcPlaySound_CONSTRUCTION_WATER;
-
-/* depot_gui.cpp */
-CommandCallback CcCloneVehicle;
-
-/* game/game_instance.cpp */
-CommandCallback CcGame;
-
-/* group_gui.cpp */
-CommandCallback CcCreateGroup;
-CommandCallback CcAddVehicleNewGroup;
-
-/* industry_gui.cpp */
-CommandCallback CcBuildIndustry;
-
-/* main_gui.cpp */
-CommandCallback CcPlaySound_EXPLOSION;
-CommandCallback CcPlaceSign;
-CommandCallback CcTerraform;
-
-/* rail_gui.cpp */
-CommandCallback CcPlaySound_CONSTRUCTION_RAIL;
-CommandCallback CcRailDepot;
-CommandCallback CcStation;
-CommandCallback CcBuildRailTunnel;
-
-/* road_gui.cpp */
-CommandCallback CcPlaySound_CONSTRUCTION_OTHER;
-CommandCallback CcBuildRoadTunnel;
-CommandCallback CcRoadDepot;
-CommandCallback CcRoadStop;
-
-/* train_gui.cpp */
-CommandCallback CcBuildWagon;
-
-/* town_gui.cpp */
-CommandCallback CcFoundTown;
-CommandCallback CcFoundRandomTown;
-
-/* vehicle_gui.cpp */
-CommandCallback CcBuildPrimaryVehicle;
-CommandCallback CcStartStopVehicle;
-
#endif /* COMMAND_FUNC_H */
diff --git a/src/depot_cmd.h b/src/depot_cmd.h
index 9c39db1e2..cc9701fb7 100644
--- a/src/depot_cmd.h
+++ b/src/depot_cmd.h
@@ -16,4 +16,6 @@ CommandProc CmdRenameDepot;
DEF_CMD_TRAIT(CMD_RENAME_DEPOT, CmdRenameDepot, 0, CMDT_OTHER_MANAGEMENT)
+CommandCallback CcCloneVehicle;
+
#endif /* DEPOT_CMD_H */
diff --git a/src/dock_cmd.h b/src/dock_cmd.h
new file mode 100644
index 000000000..d1c132470
--- /dev/null
+++ b/src/dock_cmd.h
@@ -0,0 +1,18 @@
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file dock_cmd.h Command definitions related to docks. */
+
+#ifndef DOCK_CMD_H
+#define DOCK_CMD_H
+
+#include "command_type.h"
+
+CommandCallback CcBuildDocks;
+CommandCallback CcPlaySound_CONSTRUCTION_WATER;
+
+#endif /* DOCK_CMD_H */
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index c1f615612..0ba34e211 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -25,6 +25,8 @@
#include "hotkeys.h"
#include "gui.h"
#include "zoom_func.h"
+#include "tunnelbridge_cmd.h"
+#include "dock_cmd.h"
#include "widgets/dock_widget.h"
diff --git a/src/group_cmd.h b/src/group_cmd.h
index a58a6f8aa..7f3496cc9 100644
--- a/src/group_cmd.h
+++ b/src/group_cmd.h
@@ -30,4 +30,7 @@ DEF_CMD_TRAIT(CMD_REMOVE_ALL_VEHICLES_GROUP, CmdRemoveAllVehiclesGroup, 0, CMDT_
DEF_CMD_TRAIT(CMD_SET_GROUP_FLAG, CmdSetGroupFlag, 0, CMDT_ROUTE_MANAGEMENT)
DEF_CMD_TRAIT(CMD_SET_GROUP_LIVERY, CmdSetGroupLivery, 0, CMDT_ROUTE_MANAGEMENT)
+CommandCallback CcCreateGroup;
+CommandCallback CcAddVehicleNewGroup;
+
#endif /* GROUP_CMD_H */
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 316cdc4f3..f72d9d2d6 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -25,6 +25,7 @@
#include "company_base.h"
#include "company_gui.h"
#include "gui.h"
+#include "group_cmd.h"
#include "widgets/group_widget.h"
diff --git a/src/industry_cmd.h b/src/industry_cmd.h
index e1f18932a..150b59da9 100644
--- a/src/industry_cmd.h
+++ b/src/industry_cmd.h
@@ -18,4 +18,6 @@ CommandProc CmdIndustryCtrl;
DEF_CMD_TRAIT(CMD_BUILD_INDUSTRY, CmdBuildIndustry, CMD_DEITY, CMDT_LANDSCAPE_CONSTRUCTION)
DEF_CMD_TRAIT(CMD_INDUSTRY_CTRL, CmdIndustryCtrl, CMD_DEITY | CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT)
+CommandCallback CcBuildIndustry;
+
#endif /* INDUSTRY_CMD_H */
diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp
index 6df53d7da..0fae6bcbf 100644
--- a/src/network/network_command.cpp
+++ b/src/network/network_command.cpp
@@ -14,6 +14,19 @@
#include "../command_func.h"
#include "../company_func.h"
#include "../settings_type.h"
+#include "../airport_cmd.h"
+#include "../depot_cmd.h"
+#include "../dock_cmd.h"
+#include "../group_cmd.h"
+#include "../industry_cmd.h"
+#include "../rail_cmd.h"
+#include "../road_cmd.h"
+#include "../terraform_cmd.h"
+#include "../town_cmd.h"
+#include "../train_cmd.h"
+#include "../tunnelbridge_cmd.h"
+#include "../vehicle_cmd.h"
+#include "../script/script_cmd.h"
#include "../safeguards.h"
diff --git a/src/object_gui.cpp b/src/object_gui.cpp
index 234e3eab6..a3ea3f8b1 100644
--- a/src/object_gui.cpp
+++ b/src/object_gui.cpp
@@ -24,6 +24,7 @@
#include "window_gui.h"
#include "window_func.h"
#include "zoom_func.h"
+#include "terraform_cmd.h"
#include "widgets/object_widget.h"
diff --git a/src/rail_cmd.h b/src/rail_cmd.h
index e625eb03d..1fb0fdee0 100644
--- a/src/rail_cmd.h
+++ b/src/rail_cmd.h
@@ -34,4 +34,9 @@ DEF_CMD_TRAIT(CMD_CONVERT_RAIL, CmdConvertRail, 0,
DEF_CMD_TRAIT(CMD_BUILD_SIGNAL_TRACK, CmdBuildSignalTrack, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION)
DEF_CMD_TRAIT(CMD_REMOVE_SIGNAL_TRACK, CmdRemoveSignalTrack, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION)
+CommandCallback CcPlaySound_CONSTRUCTION_RAIL;
+CommandCallback CcRailDepot;
+CommandCallback CcStation;
+CommandCallback CcBuildRailTunnel;
+
#endif /* RAIL_CMD_H */
diff --git a/src/road_cmd.h b/src/road_cmd.h
index 4908f72e3..05f064b0b 100644
--- a/src/road_cmd.h
+++ b/src/road_cmd.h
@@ -29,4 +29,9 @@ DEF_CMD_TRAIT(CMD_BUILD_ROAD, CmdBuildRoad, CMD_AUTO | CMD_NO_WATER |
DEF_CMD_TRAIT(CMD_BUILD_ROAD_DEPOT, CmdBuildRoadDepot, CMD_AUTO | CMD_NO_WATER, CMDT_LANDSCAPE_CONSTRUCTION)
DEF_CMD_TRAIT(CMD_CONVERT_ROAD, CmdConvertRoad, 0, CMDT_LANDSCAPE_CONSTRUCTION)
+CommandCallback CcPlaySound_CONSTRUCTION_OTHER;
+CommandCallback CcBuildRoadTunnel;
+CommandCallback CcRoadDepot;
+CommandCallback CcRoadStop;
+
#endif /* ROAD_CMD_H */
diff --git a/src/script/CMakeLists.txt b/src/script/CMakeLists.txt
index f4b87dc3b..d1054ca5f 100644
--- a/src/script/CMakeLists.txt
+++ b/src/script/CMakeLists.txt
@@ -5,6 +5,7 @@ if(OPTION_TOOLS_ONLY)
endif()
add_files(
+ script_cmd.h
script_config.cpp
script_config.hpp
script_fatalerror.hpp
diff --git a/src/script/script_cmd.h b/src/script/script_cmd.h
new file mode 100644
index 000000000..bf6aa50c7
--- /dev/null
+++ b/src/script/script_cmd.h
@@ -0,0 +1,18 @@
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file script_cmd.h Command definitions related to scripts. */
+
+#ifndef SCRIPT_CMD_H
+#define SCRIPT_CMD_H
+
+#include "../command_type.h"
+
+CommandCallback CcAI;
+CommandCallback CcGame;
+
+#endif /* SCRIPT_CMD_H */
diff --git a/src/terraform_cmd.h b/src/terraform_cmd.h
index 88aeaec4c..9b5866efa 100644
--- a/src/terraform_cmd.h
+++ b/src/terraform_cmd.h
@@ -18,4 +18,8 @@ CommandProc CmdLevelLand;
DEF_CMD_TRAIT(CMD_TERRAFORM_LAND, CmdTerraformLand, CMD_ALL_TILES | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION)
DEF_CMD_TRAIT(CMD_LEVEL_LAND, CmdLevelLand, CMD_ALL_TILES | CMD_AUTO | CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION) // test run might clear tiles multiple times, in execution that only happens once
+CommandCallback CcPlaySound_EXPLOSION;
+CommandCallback CcPlaceSign;
+CommandCallback CcTerraform;
+
#endif /* TERRAFORM_CMD_H */
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 0325a957f..a55833279 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -31,7 +31,9 @@
#include "hotkeys.h"
#include "engine_base.h"
#include "terraform_gui.h"
+#include "terraform_cmd.h"
#include "zoom_func.h"
+#include "rail_cmd.h"
#include "widgets/terraform_widget.h"
diff --git a/src/town_cmd.h b/src/town_cmd.h
index bd4f4de11..7842e7dda 100644
--- a/src/town_cmd.h
+++ b/src/town_cmd.h
@@ -32,4 +32,7 @@ DEF_CMD_TRAIT(CMD_TOWN_SET_TEXT, CmdTownSetText, CMD_DEITY | CMD_STR_CTRL,
DEF_CMD_TRAIT(CMD_EXPAND_TOWN, CmdExpandTown, CMD_DEITY, CMDT_LANDSCAPE_CONSTRUCTION)
DEF_CMD_TRAIT(CMD_DELETE_TOWN, CmdDeleteTown, CMD_OFFLINE, CMDT_LANDSCAPE_CONSTRUCTION)
+CommandCallback CcFoundTown;
+CommandCallback CcFoundRandomTown;
+
#endif /* TOWN_CMD_H */
diff --git a/src/train_cmd.h b/src/train_cmd.h
index f9452f1b5..7b286e998 100644
--- a/src/train_cmd.h
+++ b/src/train_cmd.h
@@ -25,4 +25,6 @@ DEF_CMD_TRAIT(CMD_MOVE_RAIL_VEHICLE, CmdMoveRailVehicle, 0, CMDT_VEH
DEF_CMD_TRAIT(CMD_FORCE_TRAIN_PROCEED, CmdForceTrainProceed, 0, CMDT_VEHICLE_MANAGEMENT)
DEF_CMD_TRAIT(CMD_REVERSE_TRAIN_DIRECTION, CmdReverseTrainDirection, 0, CMDT_VEHICLE_MANAGEMENT)
+CommandCallback CcBuildWagon;
+
#endif /* TRAIN_CMD_H */
diff --git a/src/tunnelbridge_cmd.h b/src/tunnelbridge_cmd.h
index 58cb9b32a..6c78db48b 100644
--- a/src/tunnelbridge_cmd.h
+++ b/src/tunnelbridge_cmd.h
@@ -18,4 +18,6 @@ CommandProc CmdBuildTunnel;
DEF_CMD_TRAIT(CMD_BUILD_BRIDGE, CmdBuildBridge, CMD_DEITY | CMD_AUTO | CMD_NO_WATER, CMDT_LANDSCAPE_CONSTRUCTION)
DEF_CMD_TRAIT(CMD_BUILD_TUNNEL, CmdBuildTunnel, CMD_DEITY | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION)
+CommandCallback CcBuildBridge;
+
#endif /* TUNNELBRIDGE_CMD_H */
diff --git a/src/vehicle_cmd.h b/src/vehicle_cmd.h
index a2d8d62bf..e6872e838 100644
--- a/src/vehicle_cmd.h
+++ b/src/vehicle_cmd.h
@@ -36,4 +36,7 @@ DEF_CMD_TRAIT(CMD_MASS_START_STOP, CmdMassStartStopVehicle, 0,
DEF_CMD_TRAIT(CMD_DEPOT_SELL_ALL_VEHICLES, CmdDepotSellAllVehicles, 0, CMDT_VEHICLE_CONSTRUCTION)
DEF_CMD_TRAIT(CMD_DEPOT_MASS_AUTOREPLACE, CmdDepotMassAutoReplace, 0, CMDT_VEHICLE_CONSTRUCTION)
+CommandCallback CcBuildPrimaryVehicle;
+CommandCallback CcStartStopVehicle;
+
#endif /* VEHICLE_CMD_H */
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 69fb15846..abe1b9dd9 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -36,6 +36,7 @@
#include "station_base.h"
#include "tilehighlight_func.h"
#include "zoom_func.h"
+#include "depot_cmd.h"
#include "safeguards.h"