OpenTTD Source 20250524-master-gc366e6a48e
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#include "station_type.h"
17#include "town_type.h"
18
19enum RoadStopClassID : uint16_t;
20
21void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt);
22void UpdateNearestTownForRoadTiles(bool invalidate);
23
24CommandCost CmdBuildLongRoad(DoCommandFlags flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, DisallowedRoadDirections drd, bool start_half, bool end_half, bool is_ai);
25std::tuple<CommandCost, Money> CmdRemoveLongRoad(DoCommandFlags flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, bool start_half, bool end_half);
28CommandCost CmdConvertRoad(DoCommandFlags flags, TileIndex tile, TileIndex area_start, RoadType to_type, bool diagonal);
29
31DEF_CMD_TRAIT(CMD_REMOVE_LONG_ROAD, CmdRemoveLongRoad, CommandFlags({CommandFlag::Auto, CommandFlag::NoTest}), 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.
35
36CommandCallback CcPlaySound_CONSTRUCTION_OTHER;
37CommandCallback CcBuildRoadTunnel;
38void CcRoadDepot(Commands cmd, const CommandCost &result, TileIndex tile, RoadType rt, DiagDirection dir);
39void 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);
40
41#endif /* ROAD_CMD_H */
Common return value for all commands.
Enum-as-bit-set wrapper.
Types related to commands.
@ CMDT_LANDSCAPE_CONSTRUCTION
Construction and destruction of objects on the map.
void CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile)
Define a callback function for the client, after the command is finished.
@ Auto
set the DoCommandFlag::Auto flag on this command
@ NoWater
set the DoCommandFlag::NoWater flag on this command
@ Deity
the command may be executed by COMPANY_DEITY
@ NoTest
the command's output may differ between test and execute due to town rating changes etc.
Commands
List of commands.
@ CMD_BUILD_LONG_ROAD
build a complete road (not a "half" one)
@ CMD_BUILD_ROAD
build a "half" road
@ CMD_CONVERT_ROAD
convert a road type
@ CMD_REMOVE_LONG_ROAD
remove a complete road (not a "half" one)
@ CMD_BUILD_ROAD_DEPOT
build a road depot
Different types to 'show' directions.
Axis
Allow incrementing of DiagDirDiff variables.
DiagDirection
Enumeration for diagonal directions.
RoadStopClassID
CommandCost CmdBuildRoad(DoCommandFlags flags, TileIndex tile, RoadBits pieces, RoadType rt, DisallowedRoadDirections toggle_drd, TownID town_id)
Build a piece of road.
Definition road_cmd.cpp:605
void UpdateNearestTownForRoadTiles(bool invalidate)
Updates cached nearest town for all road tiles.
CommandCost CmdBuildRoadDepot(DoCommandFlags flags, TileIndex tile, RoadType rt, DiagDirection dir)
Build a road depot.
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
Draw the road depot sprite.
CommandCost CmdBuildLongRoad(DoCommandFlags 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:972
std::tuple< CommandCost, Money > CmdRemoveLongRoad(DoCommandFlags flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, bool start_half, bool end_half)
Remove a long piece of road.
CommandCost CmdConvertRoad(DoCommandFlags flags, TileIndex tile, TileIndex area_start, RoadType to_type, bool diagonal)
Convert one road subtype to another.
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:195
Enums and other types related to roads.
RoadBits
Enumeration for the road parts on a tile.
Definition road_type.h:40
RoadType
The different roadtypes we support.
Definition road_type.h:23
DisallowedRoadDirections
Which directions are disallowed ?
Definition road_type.h:61
Types related to stations.
RoadStopType
Types of RoadStops.
Types related to towns.