OpenTTD Source
20241121-master-g67a0fccfad
|
Command definitions for rail. More...
Go to the source code of this file.
Functions | |
CommandCost | CmdBuildRailroadTrack (DoCommandFlag flags, TileIndex end_tile, TileIndex start_tile, RailType railtype, Track track, bool auto_remove_signals, bool fail_on_obstacle) |
Build rail on a stretch of track. More... | |
CommandCost | CmdRemoveRailroadTrack (DoCommandFlag flags, TileIndex end_tile, TileIndex start_tile, Track track) |
Build rail on a stretch of track. More... | |
CommandCost | CmdBuildSingleRail (DoCommandFlag flags, TileIndex tile, RailType railtype, Track track, bool auto_remove_signals) |
Build a single piece of rail. More... | |
CommandCost | CmdRemoveSingleRail (DoCommandFlag flags, TileIndex tile, Track track) |
Remove a single piece of track. More... | |
CommandCost | CmdBuildTrainDepot (DoCommandFlag flags, TileIndex tile, RailType railtype, DiagDirection dir) |
Build a train depot. More... | |
CommandCost | CmdBuildSingleSignal (DoCommandFlag flags, TileIndex tile, Track track, SignalType sigtype, SignalVariant sigvar, bool convert_signal, bool skip_existing_signals, bool ctrl_pressed, SignalType cycle_start, SignalType cycle_stop, uint8_t num_dir_cycle, uint8_t signals_copy) |
Build signals, alternate between double/single, signal/semaphore, pre/exit/combo-signals, and what-else not. More... | |
CommandCost | CmdRemoveSingleSignal (DoCommandFlag flags, TileIndex tile, Track track) |
Remove signals. More... | |
CommandCost | CmdConvertRail (DoCommandFlag flags, TileIndex tile, TileIndex area_start, RailType totype, bool diagonal) |
Convert one rail type to the other. More... | |
CommandCost | CmdBuildSignalTrack (DoCommandFlag flags, TileIndex tile, TileIndex end_tile, Track track, SignalType sigtype, SignalVariant sigvar, bool mode, bool autofill, bool minimise_gaps, uint8_t signal_density) |
Build signals on a stretch of track. More... | |
CommandCost | CmdRemoveSignalTrack (DoCommandFlag flags, TileIndex tile, TileIndex end_tile, Track track, bool autofill) |
Remove signals on a stretch of track. More... | |
void | CcRailDepot (Commands cmd, const CommandCost &result, TileIndex tile, RailType rt, DiagDirection dir) |
Variables | |
CommandCallback | CcPlaySound_CONSTRUCTION_RAIL |
CommandCallback | CcStation |
CommandCallback | CcBuildRailTunnel |
Command definitions for rail.
Definition in file rail_cmd.h.
CommandCost CmdBuildRailroadTrack | ( | DoCommandFlag | flags, |
TileIndex | end_tile, | ||
TileIndex | start_tile, | ||
RailType | railtype, | ||
Track | track, | ||
bool | auto_remove_signals, | ||
bool | fail_on_obstacle | ||
) |
Build rail on a stretch of track.
Stub for the unified rail builder/remover
flags | operation to perform |
end_tile | end tile of drag |
start_tile | start tile of drag |
railtype | railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building |
track | track-orientation |
auto_remove_signals | false = build up to an obstacle, true = fail if an obstacle is found (used for AIs). |
fail_on_obstacle | false = error on signal in the way, true = auto remove signals when in the way |
Definition at line 932 of file rail_cmd.cpp.
References CmdRailTrackHelper().
CommandCost CmdBuildSignalTrack | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
TileIndex | end_tile, | ||
Track | track, | ||
SignalType | sigtype, | ||
SignalVariant | sigvar, | ||
bool | mode, | ||
bool | autofill, | ||
bool | minimise_gaps, | ||
uint8_t | signal_density | ||
) |
Build signals on a stretch of track.
Stub for the unified signal builder/remover
flags | operation to perform |
tile | start tile of drag |
end_tile | end tile of drag |
track | track-orientation |
sigtype | default signal type |
sigvar | signal variant to build |
mode | true = override signal/semaphore, or pre/exit/combo signal (CTRL-toggle) |
autofill | fill beyond selected stretch? |
minimise_gaps | false = keep fixed distance, true = minimise gaps between signals |
signal_density | user defined signals_density |
Definition at line 1449 of file rail_cmd.cpp.
References CmdSignalTrackHelper().
CommandCost CmdBuildSingleRail | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
RailType | railtype, | ||
Track | track, | ||
bool | auto_remove_signals | ||
) |
Build a single piece of rail.
flags | operation to perform |
tile | tile to build on |
railtype | railtype of being built piece (normal, mono, maglev) |
track | track-orientation |
auto_remove_signals | false = error on signal in the way, true = auto remove signals when in the way |
Definition at line 426 of file rail_cmd.cpp.
References EXPENSES_CONSTRUCTION, and ValParamRailType().
CommandCost CmdBuildSingleSignal | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
Track | track, | ||
SignalType | sigtype, | ||
SignalVariant | sigvar, | ||
bool | convert_signal, | ||
bool | skip_existing_signals, | ||
bool | ctrl_pressed, | ||
SignalType | cycle_start, | ||
SignalType | cycle_stop, | ||
uint8_t | num_dir_cycle, | ||
uint8_t | signals_copy | ||
) |
Build signals, alternate between double/single, signal/semaphore, pre/exit/combo-signals, and what-else not.
If the rail piece does not have any signals, signal cycling is ignored
flags | operation to perform |
tile | tile where to build the signals |
track | track-orientation |
sigtype | type of the signal |
sigvar | variant of signal type (normal/semaphore) |
ctrl_pressed | true = override signal/semaphore, or pre/exit/combo signal or toggle variant (CTRL-toggle) |
convert_signal | convert the present signal type and variant |
cycle_start | start cycle from this signal type |
cycle_stop | wrap around after this signal type |
num_dir_cycle | cycle the signal direction this many times |
skip_existing_signals | true = don't modify an existing signal but don't fail either, false = always set new signal type |
signals_copy | used for CmdBuildManySignals() to copy direction of first signal |
Definition at line 1052 of file rail_cmd.cpp.
CommandCost CmdBuildTrainDepot | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
RailType | railtype, | ||
DiagDirection | dir | ||
) |
Build a train depot.
flags | operation to perform |
tile | position of the train depot |
railtype | rail type |
dir | entrance direction |
Definition at line 963 of file rail_cmd.cpp.
References _settings_game, CommandCost::AddCost(), ConstructionSettings::build_on_slopes, CanBuildDepotByTileh(), CMD_ERROR, GameSettings::construction, EXPENSES_CONSTRUCTION, GetTileSlope(), IsValidDiagDirection(), return_cmd_error, SLOPE_FLAT, and ValParamRailType().
CommandCost CmdConvertRail | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
TileIndex | area_start, | ||
RailType | totype, | ||
bool | diagonal | ||
) |
Convert one rail type to the other.
You can convert normal rail to monorail/maglev easily or vice-versa.
flags | operation to perform |
tile | end tile of rail conversion drag |
area_start | start tile of drag |
totype | new railtype to convert to. |
diagonal | build diagonally or not. |
Definition at line 1553 of file rail_cmd.cpp.
References _settings_game, CommandCost::AddCost(), CCF_TRACK, CheckTileOwnership(), CMD_ERROR, CountBits(), TileIterator::Create(), DC_EXEC, DiagDirToDiagTrack(), DirtyCompanyInfrastructureWindows(), VehicleSettings::disable_elrails, EnsureNoTrainOnTrackBits(), EnsureNoVehicleOnGround(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), FindVehicleOnPos(), FreeTrainTrackReservation(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetCrossingRailTrack(), GetOtherTunnelBridgeEnd(), GetRailDepotTrack(), GetRailStationTrack(), GetRailTileType(), GetRailType(), GetReservedTrackbits(), GetTileOwner(), GetTileType(), GetTrackBits(), GetTrainForReservation(), GetTunnelBridgeDirection(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), HasPowerOnRail(), HasStationRail(), HasTunnelBridgeReservation(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::infrastructure, INVALID_TILE, INVALID_TRACK, InvalidateWindowData(), IsBridge(), IsCompatibleRail(), IsLevelCrossing(), IsLevelCrossingTile(), IsPlainRailTile(), IsRailStationTile(), IsStationTileBlocked(), LEVELCROSSING_TRACKBIT_FACTOR, CommandCost::MakeError(), MarkBridgeDirty(), MarkTileDirtyByTile(), MP_RAILWAY, MP_ROAD, MP_STATION, MP_TUNNELBRIDGE, CompanyInfrastructure::rail, RAIL_TILE_DEPOT, RailConvertCost(), RailNoLevelCrossings(), RAILTYPE_ELECTRIC, RAILTYPE_RAIL, RemoveFirstTrack(), SetRailType(), Map::Size(), TRACK_BIT_NONE, TracksOverlap(), TRANSPORT_RAIL, TryPathReserve(), TUNNELBRIDGE_TRACKBIT_FACTOR, TunnelBridgeIsFree(), UpdateTrainPowerProc(), ValParamRailType(), GameSettings::vehicle, WC_BUILD_VEHICLE, WC_VEHICLE_DEPOT, and YapfNotifyTrackLayoutChange().
CommandCost CmdRemoveRailroadTrack | ( | DoCommandFlag | flags, |
TileIndex | end_tile, | ||
TileIndex | start_tile, | ||
Track | track | ||
) |
Build rail on a stretch of track.
Stub for the unified rail builder/remover
flags | operation to perform |
end_tile | end tile of drag |
start_tile | start tile of drag |
track | track-orientation |
Definition at line 947 of file rail_cmd.cpp.
References CmdRailTrackHelper(), and INVALID_RAILTYPE.
CommandCost CmdRemoveSignalTrack | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
TileIndex | end_tile, | ||
Track | track, | ||
bool | autofill | ||
) |
Remove signals on a stretch of track.
Stub for the unified signal builder/remover
flags | operation to perform |
tile | start tile of drag |
end_tile | end tile of drag |
track | track-orientation |
autofill | fill beyond selected stretch? |
Definition at line 1527 of file rail_cmd.cpp.
References CmdSignalTrackHelper(), SIG_ELECTRIC, and SIGTYPE_BLOCK.
CommandCost CmdRemoveSingleRail | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
Track | track | ||
) |
Remove a single piece of track.
flags | operation to perform |
tile | tile to remove track from |
track | rail orientation |
Definition at line 615 of file rail_cmd.cpp.
References EXPENSES_CONSTRUCTION.
CommandCost CmdRemoveSingleSignal | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
Track | track | ||
) |
Remove signals.
flags | operation to perform |
tile | coordinates where signal is being deleted from |
track | track-orientation |
Definition at line 1461 of file rail_cmd.cpp.