OpenTTD Source: src/station_cmd.h Source File

OpenTTD Source 15.3

station_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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef STATION_CMD_H
11#define STATION_CMD_H
12
13#include "command_type.h"
14#include "rail_type.h"
15#include "road_type.h"
16#include "station_type.h"
17
18struct Town;
19
20enum StationClassID : uint16_t;
21enum RoadStopClassID : uint16_t;
22
23extern Town *AirportGetNearestTown(const struct AirportSpec *as, Direction rotation, TileIndex tile, TileIterator &&it, uint &mindist);
24extern uint8_t GetAirportNoiseLevelForDistance(const struct AirportSpec *as, uint distance);
25
26 CommandCost CmdBuildAirport(DoCommandFlags flags, TileIndex tile, uint8_t airport_type, uint8_t layout, StationID station_to_join, bool allow_adjacent);
27 CommandCost CmdBuildDock(DoCommandFlags flags, TileIndex tile, StationID station_to_join, bool adjacent);
28 CommandCost CmdBuildRailStation(DoCommandFlags flags, TileIndex tile_org, RailType rt, Axis axis, uint8_t numtracks, uint8_t plat_len, StationClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent);
29 CommandCost CmdRemoveFromRailStation(DoCommandFlags flags, TileIndex start, TileIndex end, bool keep_rail);
30 CommandCost CmdBuildRoadStop(DoCommandFlags flags, TileIndex tile, uint8_t width, uint8_t length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, RoadStopClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent);
31 CommandCost CmdRemoveRoadStop(DoCommandFlags flags, TileIndex tile, uint8_t width, uint8_t height, RoadStopType stop_type, bool remove_road);
32 CommandCost CmdRenameStation(DoCommandFlags flags, StationID station_id, const std::string &text);
33std::tuple<CommandCost, StationID> CmdMoveStationName(DoCommandFlags flags, StationID station_id, TileIndex tile);
34 CommandCost CmdOpenCloseAirport(DoCommandFlags flags, StationID station_id);
35
36DEF_CMD_TRAIT(CMD_BUILD_AIRPORT, CmdBuildAirport, CommandFlags({CommandFlag::Auto, CommandFlag::NoWater}), CommandType::LandscapeConstruction)
37DEF_CMD_TRAIT(CMD_BUILD_DOCK, CmdBuildDock, CommandFlag::Auto, CommandType::LandscapeConstruction)
38DEF_CMD_TRAIT(CMD_BUILD_RAIL_STATION, CmdBuildRailStation, CommandFlags({CommandFlag::Auto, CommandFlag::NoWater}), CommandType::LandscapeConstruction)
39DEF_CMD_TRAIT(CMD_REMOVE_FROM_RAIL_STATION, CmdRemoveFromRailStation, {}, CommandType::LandscapeConstruction)
40DEF_CMD_TRAIT(CMD_BUILD_ROAD_STOP, CmdBuildRoadStop, CommandFlags({CommandFlag::Auto, CommandFlag::NoWater}), CommandType::LandscapeConstruction)
41DEF_CMD_TRAIT(CMD_REMOVE_ROAD_STOP, CmdRemoveRoadStop, {}, CommandType::LandscapeConstruction)
42DEF_CMD_TRAIT(CMD_RENAME_STATION, CmdRenameStation, {}, CommandType::OtherManagement)
43DEF_CMD_TRAIT(CMD_MOVE_STATION_NAME, CmdMoveStationName, {}, CommandType::OtherManagement)
44DEF_CMD_TRAIT(CMD_OPEN_CLOSE_AIRPORT, CmdOpenCloseAirport, {}, CommandType::RouteManagement)
45
46void CcMoveStationName(Commands cmd, const CommandCost &result, StationID station_id);
47
48#endif /* STATION_CMD_H */
CommandCost
Common return value for all commands.
Definition command_type.h:24
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
TileIterator
Base class for tile iterators.
Definition tilearea_type.h:105
command_type.h
Types related to commands.
CommandType::RouteManagement
@ RouteManagement
Modifications to route management (orders, groups, etc).
CommandType::OtherManagement
@ OtherManagement
Renaming stuff, changing company colours, placing signs, etc.
CommandType::LandscapeConstruction
@ LandscapeConstruction
Construction and destruction of objects on the map.
CommandFlag::Auto
@ Auto
set the DoCommandFlag::Auto flag on this command
CommandFlag::NoWater
@ NoWater
set the DoCommandFlag::NoWater flag on this command
Commands
Commands
List of commands.
Definition command_type.h:196
CMD_OPEN_CLOSE_AIRPORT
@ CMD_OPEN_CLOSE_AIRPORT
open/close an airport to incoming aircraft
Definition command_type.h:370
CMD_MOVE_STATION_NAME
@ CMD_MOVE_STATION_NAME
move a station name
Definition command_type.h:279
CMD_BUILD_DOCK
@ CMD_BUILD_DOCK
build a dock
Definition command_type.h:233
CMD_BUILD_AIRPORT
@ CMD_BUILD_AIRPORT
build an airport
Definition command_type.h:231
CMD_BUILD_ROAD_STOP
@ CMD_BUILD_ROAD_STOP
build a road stop
Definition command_type.h:223
CMD_BUILD_RAIL_STATION
@ CMD_BUILD_RAIL_STATION
build a rail station
Definition command_type.h:203
CMD_RENAME_STATION
@ CMD_RENAME_STATION
rename a station
Definition command_type.h:278
CMD_REMOVE_FROM_RAIL_STATION
@ CMD_REMOVE_FROM_RAIL_STATION
remove a (rectangle of) tiles from a rail station
Definition command_type.h:212
CMD_REMOVE_ROAD_STOP
@ CMD_REMOVE_ROAD_STOP
remove a road stop
Definition command_type.h:224
Direction
Direction
Defines the 8 directions on the map.
Definition direction_type.h:24
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition direction_type.h:123
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition direction_type.h:78
RoadStopClassID
RoadStopClassID
Definition newgrf_roadstop.h:33
StationClassID
StationClassID
Definition newgrf_station.h:103
rail_type.h
The different types of rail.
RailType
RailType
Enumeration for all possible railtypes.
Definition rail_type.h:25
road_type.h
Enums and other types related to roads.
RoadType
RoadType
The different roadtypes we support.
Definition road_type.h:23
GetAirportNoiseLevelForDistance
uint8_t GetAirportNoiseLevelForDistance(const AirportSpec *as, uint distance)
Get a possible noise reduction factor based on distance from town center.
Definition station_cmd.cpp:2523
AirportGetNearestTown
Town * AirportGetNearestTown(const AirportSpec *as, Direction rotation, TileIndex tile, TileIterator &&it, uint &mindist)
Finds the town nearest to given airport.
Definition station_cmd.cpp:2554
CmdMoveStationName
std::tuple< CommandCost, StationID > CmdMoveStationName(DoCommandFlags flags, StationID station_id, TileIndex tile)
Move a station name.
Definition station_cmd.cpp:4502
CmdRenameStation
CommandCost CmdRenameStation(DoCommandFlags flags, StationID station_id, const std::string &text)
Rename a station.
Definition station_cmd.cpp:4465
CmdBuildDock
CommandCost CmdBuildDock(DoCommandFlags flags, TileIndex tile, StationID station_to_join, bool adjacent)
Build a dock/haven.
Definition station_cmd.cpp:2892
CmdRemoveRoadStop
CommandCost CmdRemoveRoadStop(DoCommandFlags flags, TileIndex tile, uint8_t width, uint8_t height, RoadStopType stop_type, bool remove_road)
Remove bus or truck stops.
Definition station_cmd.cpp:2483
CmdBuildRoadStop
CommandCost CmdBuildRoadStop(DoCommandFlags flags, TileIndex tile, uint8_t width, uint8_t length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, RoadStopClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent)
Build a bus or truck stop.
Definition station_cmd.cpp:2071
CmdBuildAirport
CommandCost CmdBuildAirport(DoCommandFlags flags, TileIndex tile, uint8_t airport_type, uint8_t layout, StationID station_to_join, bool allow_adjacent)
Place an Airport.
Definition station_cmd.cpp:2627
CmdOpenCloseAirport
CommandCost CmdOpenCloseAirport(DoCommandFlags flags, StationID station_id)
Open/close an airport to incoming aircraft.
Definition station_cmd.cpp:2836
CcMoveStationName
void CcMoveStationName(Commands cmd, const CommandCost &result, StationID station_id)
Callback function that is called after a name is moved.
Definition station_cmd.cpp:4539
CmdRemoveFromRailStation
CommandCost CmdRemoveFromRailStation(DoCommandFlags flags, TileIndex start, TileIndex end, bool keep_rail)
Remove a single tile from a rail station.
Definition station_cmd.cpp:1855
CmdBuildRailStation
CommandCost CmdBuildRailStation(DoCommandFlags flags, TileIndex tile_org, RailType rt, Axis axis, uint8_t numtracks, uint8_t plat_len, StationClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent)
Build rail station.
Definition station_cmd.cpp:1438
station_type.h
Types related to stations.
RoadStopType
RoadStopType
Types of RoadStops.
Definition station_type.h:43
AirportSpec
Defines the data structure for an airport.
Definition newgrf_airport.h:109
PoolID< uint16_t, struct StationIDTag, 64000, 0xFFFF >
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
Town
Town data structure.
Definition town.h:63
Town::text
EncodedString text
General text with additional information.
Definition town.h:114
Town::layout
TownLayout layout
town specific road layout
Definition town.h:151
Town::flags
TownFlags flags
See TownFlags.
Definition town.h:75