OpenTTD Source: src/road_cmd.h Source File

OpenTTD Source 14.0-beta1

road_cmd.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
6 */
7
10 #ifndef ROAD_CMD_H
11 #define ROAD_CMD_H
12
13 #include "direction_type.h"
14 #include "road_type.h"
15 #include "command_type.h"
16
17 enum RoadStopClassID : byte;
18
19 void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt);
20 void UpdateNearestTownForRoadTiles(bool invalidate);
21
22 CommandCost CmdBuildLongRoad(DoCommandFlag flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, DisallowedRoadDirections drd, bool start_half, bool end_half, bool is_ai);
23 std::tuple<CommandCost, Money> CmdRemoveLongRoad(DoCommandFlag flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, bool start_half, bool end_half);
24 CommandCost CmdBuildRoad(DoCommandFlag flags, TileIndex tile, RoadBits pieces, RoadType rt, DisallowedRoadDirections toggle_drd, TownID town_id);
25 CommandCost CmdBuildRoadDepot(DoCommandFlag flags, TileIndex tile, RoadType rt, DiagDirection dir);
26 CommandCost CmdConvertRoad(DoCommandFlag flags, TileIndex tile, TileIndex area_start, RoadType to_type);
27
28 DEF_CMD_TRAIT(CMD_BUILD_LONG_ROAD, CmdBuildLongRoad, CMD_AUTO | CMD_NO_WATER | CMD_DEITY, CMDT_LANDSCAPE_CONSTRUCTION)
29 DEF_CMD_TRAIT(CMD_REMOVE_LONG_ROAD, CmdRemoveLongRoad, CMD_AUTO | CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION) // towns may disallow removing road bits (as they are connected) in test, but in exec they're removed and thus removing is allowed.
30 DEF_CMD_TRAIT(CMD_BUILD_ROAD, CmdBuildRoad, CMD_AUTO | CMD_NO_WATER | CMD_DEITY, CMDT_LANDSCAPE_CONSTRUCTION)
31 DEF_CMD_TRAIT(CMD_BUILD_ROAD_DEPOT, CmdBuildRoadDepot, CMD_AUTO | CMD_NO_WATER, CMDT_LANDSCAPE_CONSTRUCTION)
32 DEF_CMD_TRAIT(CMD_CONVERT_ROAD, CmdConvertRoad, 0, CMDT_LANDSCAPE_CONSTRUCTION)
33
34 CommandCallback CcPlaySound_CONSTRUCTION_OTHER;
35 CommandCallback CcBuildRoadTunnel;
36 void CcRoadDepot(Commands cmd, const CommandCost &result, TileIndex tile, RoadType rt, DiagDirection dir);
37 void CcRoadStop(Commands cmd, const CommandCost &result, TileIndex tile, uint8_t width, uint8_t length, RoadStopType, bool is_drive_through, DiagDirection dir, RoadType, RoadStopClassID spec_class, uint16_t spec_index, StationID, bool);
38
39 #endif /* ROAD_CMD_H */
CMD_BUILD_LONG_ROAD
@ CMD_BUILD_LONG_ROAD
build a complete road (not a "half" one)
Definition: command_type.h:212
CMD_BUILD_ROAD_DEPOT
@ CMD_BUILD_ROAD_DEPOT
build a road depot
Definition: command_type.h:215
CMD_CONVERT_ROAD
@ CMD_CONVERT_ROAD
convert a road type
Definition: command_type.h:216
CMD_BUILD_ROAD
@ CMD_BUILD_ROAD
build a "half" road
Definition: command_type.h:214
direction_type.h
CMD_REMOVE_LONG_ROAD
@ CMD_REMOVE_LONG_ROAD
remove a complete road (not a "half" one)
Definition: command_type.h:213
RoadStopType
RoadStopType
Types of RoadStops.
Definition: station_type.h:43
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition: direction_type.h:116
DrawRoadDepotSprite
enum RoadStopClassID byte void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
Draw the road depot sprite.
Definition: road_cmd.cpp:1866
UpdateNearestTownForRoadTiles
void UpdateNearestTownForRoadTiles(bool invalidate)
Updates cached nearest town for all road tiles.
Definition: road_cmd.cpp:1909
CmdBuildRoad
CommandCost CmdBuildRoad(DoCommandFlag flags, TileIndex tile, RoadBits pieces, RoadType rt, DisallowedRoadDirections toggle_drd, TownID town_id)
Build a piece of road.
Definition: road_cmd.cpp:610
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
CommandCallback
void CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile)
Define a callback function for the client, after the command is finished.
Definition: command_type.h:479
DoCommandFlag
DoCommandFlag
List of flags for a command.
Definition: command_type.h:369
CMD_DEITY
@ CMD_DEITY
the command may be executed by COMPANY_DEITY
Definition: command_type.h:400
CmdBuildLongRoad
CommandCost CmdBuildLongRoad(DoCommandFlag flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, DisallowedRoadDirections drd, bool start_half, bool end_half, bool is_ai)
Build a long piece of road.
Definition: road_cmd.cpp:979
CommandCost
Common return value for all commands.
Definition: command_type.h:23
CMD_AUTO
@ CMD_AUTO
set the DC_AUTO flag on this command
Definition: command_type.h:395
DisallowedRoadDirections
DisallowedRoadDirections
Which directions are disallowed ?
Definition: road_type.h:73
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:73
CmdBuildRoadDepot
CommandCost CmdBuildRoadDepot(DoCommandFlag flags, TileIndex tile, RoadType rt, DiagDirection dir)
Build a road depot.
Definition: road_cmd.cpp:1155
command_type.h
CMD_NO_WATER
@ CMD_NO_WATER
set the DC_NO_WATER flag on this command
Definition: command_type.h:398
CcRoadStop
void CcRoadStop(Commands cmd, const CommandCost &result, TileIndex tile, uint8_t width, uint8_t length, RoadStopType, bool is_drive_through, DiagDirection dir, RoadType, RoadStopClassID spec_class, uint16_t spec_index, StationID, bool)
Command callback for building road stops.
Definition: road_gui.cpp:181
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:25
CMD_NO_TEST
@ CMD_NO_TEST
the command's output may differ between test and execute due to town rating changes etc.
Definition: command_type.h:397
RoadBits
RoadBits
Enumeration for the road parts on a tile.
Definition: road_type.h:52
CcBuildRoadTunnel
void CcBuildRoadTunnel(Commands, const CommandCost &result, TileIndex start_tile)
Callback executed after a build road tunnel command has been called.
Definition: road_gui.cpp:127
CmdRemoveLongRoad
std::tuple< CommandCost, Money > CmdRemoveLongRoad(DoCommandFlag flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, bool start_half, bool end_half)
Remove a long piece of road.
Definition: road_cmd.cpp:1081
road_type.h
Commands
Commands
List of commands.
Definition: command_type.h:187
RoadStopClassID
RoadStopClassID
Definition: newgrf_roadstop.h:25
CMDT_LANDSCAPE_CONSTRUCTION
@ CMDT_LANDSCAPE_CONSTRUCTION
Construction and destruction of objects on the map.
Definition: command_type.h:409
CmdConvertRoad
CommandCost CmdConvertRoad(DoCommandFlag flags, TileIndex tile, TileIndex area_start, RoadType to_type)
Convert one road subtype to another.
Definition: road_cmd.cpp:2432