Codechange: Move command callback declarations to the cmd header files.

This commit is contained in:
Michael Lutz 2021-10-10 02:35:06 +02:00
parent 7048e1522f
commit 123c7f99c3
24 changed files with 110 additions and 56 deletions

View File

@ -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

17
src/airport_cmd.h Normal file
View File

@ -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 */

View File

@ -26,6 +26,7 @@
#include "hotkeys.h"
#include "vehicle_func.h"
#include "gui.h"
#include "airport_cmd.h"
#include "widgets/airport_widget.h"

View File

@ -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"

View File

@ -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 */

View File

@ -16,4 +16,6 @@ CommandProc CmdRenameDepot;
DEF_CMD_TRAIT(CMD_RENAME_DEPOT, CmdRenameDepot, 0, CMDT_OTHER_MANAGEMENT)
CommandCallback CcCloneVehicle;
#endif /* DEPOT_CMD_H */

18
src/dock_cmd.h Normal file
View File

@ -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 */

View File

@ -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"

View File

@ -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 */

View File

@ -25,6 +25,7 @@
#include "company_base.h"
#include "company_gui.h"
#include "gui.h"
#include "group_cmd.h"
#include "widgets/group_widget.h"

View File

@ -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 */

View File

@ -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"

View File

@ -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"

View File

@ -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 */

View File

@ -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 */

View File

@ -5,6 +5,7 @@ if(OPTION_TOOLS_ONLY)
endif()
add_files(
script_cmd.h
script_config.cpp
script_config.hpp
script_fatalerror.hpp

18
src/script/script_cmd.h Normal file
View File

@ -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 */

View File

@ -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 */

View File

@ -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"

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -36,6 +36,7 @@
#include "station_base.h"
#include "tilehighlight_func.h"
#include "zoom_func.h"
#include "depot_cmd.h"
#include "safeguards.h"