#include "stdafx.h"
#include "openttd.h"
#include "bridge_map.h"
#include "bridge.h"
#include "cmd_helper.h"
#include "debug.h"
#include "tile_cmd.h"
#include "rail_map.h"
#include "road_map.h"
#include "landscape.h"
#include "town_map.h"
#include "tunnel_map.h"
#include "viewport_func.h"
#include "command_func.h"
#include "pathfind.h"
#include "engine.h"
#include "town.h"
#include "station.h"
#include "sprite.h"
#include "depot.h"
#include "waypoint.h"
#include "rail.h"
#include "newgrf.h"
#include "yapf/yapf.h"
#include "newgrf_engine.h"
#include "newgrf_callbacks.h"
#include "newgrf_station.h"
#include "train.h"
#include "variables.h"
#include "autoslope.h"
#include "transparency.h"
#include "water.h"
#include "tunnelbridge_map.h"
#include "window_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
#include "signal_func.h"
#include "tunnelbridge.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "table/railtypes.h"
#include "table/track_land.h"
Go to the source code of this file.
Defines | |
#define | M(x) (1 << (x)) |
#define | MAYBE_DRAW_SIGNAL(x, y, z, t) if (IsSignalPresent(tile, x)) DrawSingleSignal(tile, t, GetSingleSignalState(tile, x), y, z) |
Enumerations | |
enum | { SIGNAL_TO_SOUTHWEST = 0, SIGNAL_TO_NORTHEAST = 2, SIGNAL_TO_SOUTHEAST = 4, SIGNAL_TO_NORTHWEST = 6, SIGNAL_TO_EAST = 8, SIGNAL_TO_WEST = 10, SIGNAL_TO_SOUTH = 12, SIGNAL_TO_NORTH = 14 } |
Enums holding the offsets from base signal sprite, according to the side it is representing. More... | |
Functions | |
void * | EnsureNoTrainOnTrackProc (Vehicle *v, void *data) |
static bool | EnsureNoTrainOnTrack (TileIndex tile, Track track) |
Tests if a vehicle interacts with the specified track. | |
static bool | CheckTrackCombination (TileIndex tile, TrackBits to_build, uint flags) |
Foundation | GetRailFoundation (Slope tileh, TrackBits bits) |
Checks if a track combination is valid on a specific slope and returns the needed foundation. | |
static CommandCost | CheckRailSlope (Slope tileh, TrackBits rail_bits, TrackBits existing, TileIndex tile) |
Tests if a track can be build on a tile. | |
static bool | ValParamTrackOrientation (Track track) |
CommandCost | CmdBuildSingleRail (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Build a single piece of rail. | |
CommandCost | CmdRemoveSingleRail (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Remove a single piece of track. | |
bool | FloodHalftile (TileIndex t) |
Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore. | |
static CommandCost | ValidateAutoDrag (Trackdir *trackdir, TileIndex start, TileIndex end) |
static CommandCost | CmdRailTrackHelper (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Build a stretch of railroad tracks. | |
CommandCost | CmdBuildRailroadTrack (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Build rail on a stretch of track. | |
CommandCost | CmdRemoveRailroadTrack (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Build rail on a stretch of track. | |
CommandCost | CmdBuildTrainDepot (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Build a train depot. | |
CommandCost | CmdBuildSingleSignal (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Build signals, alternate between double/single, signal/semaphore, pre/exit/combo-signals, and what-else not. | |
static bool | CheckSignalAutoFill (TileIndex &tile, Trackdir &trackdir, int &signal_ctr, bool remove) |
static CommandCost | CmdSignalTrackHelper (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Build many signals by dragging; AutoSignals. | |
CommandCost | CmdBuildSignalTrack (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Build signals on a stretch of track. | |
CommandCost | CmdRemoveSingleSignal (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Remove signals. | |
CommandCost | CmdRemoveSignalTrack (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Remove signals on a stretch of track. | |
void * | UpdateTrainPowerProc (Vehicle *v, void *data) |
Update power of train under which is the railtype being converted. | |
CommandCost | CmdConvertRail (TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
Convert one rail type to the other. | |
static CommandCost | RemoveTrainDepot (TileIndex tile, uint32 flags) |
static CommandCost | ClearTile_Track (TileIndex tile, byte flags) |
static uint | GetSaveSlopeZ (uint x, uint y, Track track) |
Get surface height in point (x,y) On tiles with halftile foundations move (x,y) to a save point wrt. | |
static void | DrawSingleSignal (TileIndex tile, Track track, byte condition, uint image, uint pos) |
static void | DrawTrackFence_NW (const TileInfo *ti) |
static void | DrawTrackFence_SE (const TileInfo *ti) |
static void | DrawTrackFence_NW_SE (const TileInfo *ti) |
static void | DrawTrackFence_NE (const TileInfo *ti) |
static void | DrawTrackFence_SW (const TileInfo *ti) |
static void | DrawTrackFence_NE_SW (const TileInfo *ti) |
static void | DrawTrackFence_NS_1 (const TileInfo *ti) |
Draw fence at eastern side of track. | |
static void | DrawTrackFence_NS_2 (const TileInfo *ti) |
Draw fence at western side of track. | |
static void | DrawTrackFence_WE_1 (const TileInfo *ti) |
Draw fence at southern side of track. | |
static void | DrawTrackFence_WE_2 (const TileInfo *ti) |
Draw fence at northern side of track. | |
static void | DrawTrackDetails (const TileInfo *ti) |
static void | DrawTrackBits (TileInfo *ti, TrackBits track) |
Draw ground sprite and track bits. | |
static void | DrawSignals (TileIndex tile, TrackBits rails) |
static void | DrawTile_Track (TileInfo *ti) |
static void | DrawTileSequence (int x, int y, SpriteID ground, const DrawTileSeqStruct *dtss, uint32 offset) |
void | DrawTrainDepotSprite (int x, int y, int dir, RailType railtype) |
void | DrawDefaultWaypointSprite (int x, int y, RailType railtype) |
static uint | GetSlopeZ_Track (TileIndex tile, uint x, uint y) |
static Foundation | GetFoundation_Track (TileIndex tile, Slope tileh) |
static void | GetAcceptedCargo_Track (TileIndex tile, AcceptedCargo ac) |
static void | AnimateTile_Track (TileIndex tile) |
static void | TileLoop_Track (TileIndex tile) |
static TrackStatus | GetTileTrackStatus_Track (TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) |
static void | ClickTile_Track (TileIndex tile) |
static void | GetTileDesc_Track (TileIndex tile, TileDesc *td) |
static void | ChangeTileOwner_Track (TileIndex tile, PlayerID old_player, PlayerID new_player) |
int | TicksToLeaveDepot (const Vehicle *v) |
Compute number of ticks when next wagon will leave a depot. | |
static VehicleEnterTileStatus | VehicleEnter_Track (Vehicle *v, TileIndex tile, int x, int y) |
static CommandCost | TestAutoslopeOnRailTile (TileIndex tile, uint flags, uint z_old, Slope tileh_old, uint z_new, Slope tileh_new, TrackBits rail_bits) |
Tests if autoslope is allowed. | |
static CommandCost | TerraformTile_Track (TileIndex tile, uint32 flags, uint z_new, Slope tileh_new) |
Variables | |
const byte | _track_sloped_sprites [14] |
static const TrackBits | _valid_tracks_without_foundation [15] |
Valid TrackBits on a specific (non-steep)-slope without foundation. | |
static const TrackBits | _valid_tracks_on_leveled_foundation [15] |
Valid TrackBits on a specific (non-steep)-slope with leveled foundation. | |
static const TileIndexDiffC | _trackdelta [] |
static uint32 | _drawtile_track_palette |
static const byte | _fractcoords_behind [4] = { 0x8F, 0x8, 0x80, 0xF8 } |
static const byte | _fractcoords_enter [4] = { 0x8A, 0x48, 0x84, 0xA8 } |
static const signed char | _deltacoord_leaveoffset [8] |
const TileTypeProcs | _tile_type_rail_procs |
Definition in file rail_cmd.cpp.
anonymous enum |
Enums holding the offsets from base signal sprite, according to the side it is representing.
The addtion of 2 per enum is necessary in order to "jump" over the green state sprite, all signal sprites being in pair, starting with the off-red state
Definition at line 1707 of file rail_cmd.cpp.
static CommandCost CheckRailSlope | ( | Slope | tileh, | |
TrackBits | rail_bits, | |||
TrackBits | existing, | |||
TileIndex | tile | |||
) | [static] |
Tests if a track can be build on a tile.
tileh | Tile slope. | |
rail_bits | Tracks to build. | |
existing | Tracks already built. | |
tile | Tile (used for water test) |
Definition at line 278 of file rail_cmd.cpp.
References FOUNDATION_INVALID, FOUNDATION_NONE, GetRailFoundation(), IsSteepSlope(), IsTileType(), MP_RAILWAY, MP_WATER, RAIL_GROUND_WATER, and return_cmd_error.
Referenced by CmdBuildSingleRail(), and TestAutoslopeOnRailTile().
CommandCost CmdBuildRailroadTrack | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
Build rail on a stretch of track.
Stub for the unified rail builder/remover
tile | start tile of drag | |
flags | operation to perform | |
p1 | end tile of drag | |
p2 | various bitstuffed elements
|
Definition at line 702 of file rail_cmd.cpp.
References ClrBit(), and CmdRailTrackHelper().
CommandCost CmdBuildSignalTrack | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
Build signals on a stretch of track.
Stub for the unified signal builder/remover
tile | start tile of drag | |
flags | operation to perform | |
p1 | end tile of drag | |
p2 | various bitstuffed elements
|
Definition at line 1090 of file rail_cmd.cpp.
References CmdSignalTrackHelper().
CommandCost CmdBuildSingleRail | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
Build a single piece of rail.
tile | tile to build on | |
flags | operation to perform | |
p1 | railtype of being built piece (normal, mono, maglev) | |
p2 | rail track to build |
Definition at line 305 of file rail_cmd.cpp.
References CommandCost::AddCost(), AddTrackToSignalBuffer(), AXIS_X, AXIS_Y, CheckRailSlope(), CMD_CONVERT_RAIL, CMD_ERROR, CMD_LANDSCAPE_CLEAR, CmdFailed(), DC_EXEC, DoCommand(), DRD_NONE, EnsureNoTrainOnTrack(), GetDisallowedRoadDirections(), GetRailType(), GetTileType(), GetTownIndex(), GetTrackBits(), HasBit(), HasPowerOnRail(), IsCompatibleRail(), IsSlopeWithOneCornerRaised(), IsTileOwner(), IsTileType(), M, MarkTileDirtyByTile(), MP_RAILWAY, MP_ROAD, MP_WATER, RAIL_GROUND_BARREN, RAIL_GROUND_WATER, RailBuildCost(), return_cmd_error, ROAD_X, ROAD_Y, ROADTYPE_HWAY, ROADTYPE_ROAD, ROADTYPE_TRAM, ROADTYPES_ALL, ROADTYPES_ROAD, ROADTYPES_ROADHWAY, ROADTYPES_ROADTRAM, ROADTYPES_TRAM, ROADTYPES_TRAMHWAY, SetTrackBits(), SLOPE_ENW, SLOPE_EW, SLOPE_FLAT, SLOPE_NS, SLOPE_NWS, SLOPE_SEN, SLOPE_WSE, TRACK_BIT_NONE, TRACK_X, TRACK_Y, TrackToTrackBits(), UpdateLevelCrossing(), ValParamRailtype(), and YapfNotifyTrackLayoutChange().
CommandCost CmdBuildSingleSignal | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
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, bit 4 (cycle signal-type) is ignored
tile | tile where to build the signals | |
flags | operation to perform | |
p1 | various bitstuffed elements
| |
p2 | used for CmdBuildManySignals() to copy direction of first signal TODO: p2 should be replaced by two bits for "along" and "against" the track. |
Definition at line 795 of file rail_cmd.cpp.
References AddTrackToSignalBuffer(), CMD_ERROR, DC_EXEC, EnsureNoTrainOnTrack(), GB(), GetPresentSignals(), GetTrackBits(), HasBit(), HasSignalOnTrack(), HasSignals(), HasTrack(), IsPlainRailTile(), IsTileType(), KillFirstBit(), MarkTileDirtyByTile(), MP_RAILWAY, return_cmd_error, SetHasSignals(), SetPresentSignals(), SetSignalStates(), SIG_ELECTRIC, SIG_SEMAPHORE, SignalOnTrack(), SIGTYPE_COMBO, SIGTYPE_NORMAL, TRACK_BIT_HORZ, TRACK_BIT_NONE, TRACK_BIT_VERT, and YapfNotifyTrackLayoutChange().
CommandCost CmdBuildTrainDepot | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
Build a train depot.
tile | position of the train depot | |
flags | operation to perform | |
p1 | rail type | |
p2 | bit 0..1 entrance direction (DiagDirection) |
Definition at line 732 of file rail_cmd.cpp.
References CommandCost::AddCost(), AddSideToSignalBuffer(), CanBuildDepotByTileh(), CMD_ERROR, CMD_LANDSCAPE_CLEAR, CmdFailed(), DC_EXEC, DiagdirToDiagTrackdir(), DoCommand(), INVALID_DIAGDIR, IsBridgeAbove(), IsSteepSlope(), MarkTileDirtyByTile(), MayHaveBridgeAbove(), return_cmd_error, SLOPE_FLAT, TrackdirToTrack(), ValParamRailtype(), and YapfNotifyTrackLayoutChange().
CommandCost CmdConvertRail | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
Convert one rail type to the other.
You can convert normal rail to monorail/maglev easily or vice-versa.
tile | end tile of rail conversion drag | |
flags | operation to perform | |
p1 | start tile of drag | |
p2 | new railtype to convert to |
Definition at line 1178 of file rail_cmd.cpp.
References CommandCost::AddCost(), AxisToTrack(), CMD_ERROR, CountBits(), DC_EXEC, DiagDirToAxis(), FindVehicleOnPos(), CommandCost::GetCost(), GetOtherTunnelBridgeEnd(), GetRailDepotDirection(), GetRailTileType(), GetRailType(), GetTileType(), GetTrackBits(), GetTunnelBridgeDirection(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), GetWaypointAxis(), HasVehicleOnTunnelBridge(), IsBridge(), IsCompatibleRail(), MapSize(), MarkTileDirtyByTile(), MP_RAILWAY, MP_ROAD, MP_STATION, MP_TUNNELBRIDGE, RAIL_TILE_DEPOT, RAIL_TILE_WAYPOINT, RailConvertCost(), RAILTYPE_ELECTRIC, RAILTYPE_RAIL, RemoveFirstTrack(), SetRailType(), Swap(), TileOffsByDiagDir(), TileX(), TileXY(), TileY(), TRACK_BIT_NONE, UpdateTrainPowerProc(), ValParamRailtype(), and YapfNotifyTrackLayoutChange().
static CommandCost CmdRailTrackHelper | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) | [static] |
Build a stretch of railroad tracks.
tile | start tile of drag | |
flags | operation to perform | |
p1 | end tile of drag | |
p2 | various bitstuffed elements
|
Definition at line 652 of file rail_cmd.cpp.
References CommandCost::AddCost(), CMD_BUILD_SINGLE_RAIL, CMD_ERROR, CMD_REMOVE_SINGLE_RAIL, CmdFailed(), DC_EXEC, DoCommand(), GB(), CommandCost::GetCost(), HasBit(), IsDiagonalTrackdir(), MapSize(), ToggleBit(), ToTileIndexDiff(), TrackdirToTrack(), TrackToTrackdir(), and ValParamRailtype().
Referenced by CmdBuildRailroadTrack(), and CmdRemoveRailroadTrack().
CommandCost CmdRemoveRailroadTrack | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
Build rail on a stretch of track.
Stub for the unified rail builder/remover
tile | start tile of drag | |
flags | operation to perform | |
p1 | end tile of drag | |
p2 | various bitstuffed elements
|
Definition at line 718 of file rail_cmd.cpp.
References CmdRailTrackHelper(), and SetBit().
CommandCost CmdRemoveSignalTrack | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
Remove signals on a stretch of track.
Stub for the unified signal builder/remover
tile | start tile of drag | |
flags | operation to perform | |
p1 | end tile of drag | |
p2 | various bitstuffed elements
|
Definition at line 1153 of file rail_cmd.cpp.
References CmdSignalTrackHelper(), and SetBit().
CommandCost CmdRemoveSingleRail | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
Remove a single piece of track.
tile | tile to remove track from | |
flags | operation to perform | |
p1 | unused | |
p2 | rail orientation |
Definition at line 439 of file rail_cmd.cpp.
References CommandCost::AddCost(), AddTrackToSignalBuffer(), CMD_ERROR, CMD_REMOVE_SIGNALS, DC_BANKRUPT, DC_EXEC, DoCommand(), EnsureNoTrainOnTrack(), GetTileOwner(), GetTileType(), GetTownIndex(), GetTrackBits(), HasSignalOnTrack(), INVALID_OWNER, IsPlainRailTile(), IsSlopeWithOneCornerRaised(), MarkTileDirtyByTile(), MP_RAILWAY, MP_ROAD, OWNER_WATER, RAIL_GROUND_WATER, ROADTYPE_HWAY, ROADTYPE_ROAD, ROADTYPE_TRAM, SetTrackBits(), TRACK_BIT_X, TRACK_BIT_Y, TRACK_X, TRACK_Y, TrackToTrackBits(), and YapfNotifyTrackLayoutChange().
CommandCost CmdRemoveSingleSignal | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) |
Remove signals.
tile | coordinates where signal is being deleted from | |
flags | operation to perform | |
p1 | various bitstuffed elements, only track information is used
| |
p2 | unused |
Definition at line 1104 of file rail_cmd.cpp.
References AddTrackToSignalBuffer(), CMD_ERROR, DC_EXEC, EnsureNoTrainOnTrack(), GB(), GetPresentSignals(), GetTileOwner(), HasSignalOnTrack(), HasTrack(), INVALID_TRACK, IsTileType(), MarkTileDirtyByTile(), MP_RAILWAY, OWNER_WATER, SetHasSignals(), SetPresentSignals(), SetSignalStates(), SIG_ELECTRIC, SignalOnTrack(), and YapfNotifyTrackLayoutChange().
static CommandCost CmdSignalTrackHelper | ( | TileIndex | tile, | |
uint32 | flags, | |||
uint32 | p1, | |||
uint32 | p2 | |||
) | [static] |
Build many signals by dragging; AutoSignals.
tile | start tile of drag | |
flags | operation to perform | |
p1 | end tile of drag | |
p2 | various bitstuffed elements
|
Definition at line 973 of file rail_cmd.cpp.
References CommandCost::AddCost(), CMD_BUILD_SIGNALS, CMD_ERROR, CMD_REMOVE_SIGNALS, CmdFailed(), CmdSucceeded(), DoCommand(), error, GB(), GetPresentSignals(), HasBit(), HasSignals(), HasTrack(), IsDiagonalTrackdir(), IsTileType(), MapSize(), MP_RAILWAY, SB(), SetBit(), SIG_ELECTRIC, SignalAgainstTrackdir(), SignalAlongTrackdir(), SignalOnTrack(), ToggleBit(), ToTileIndexDiff(), TrackdirToTrack(), and TrackToTrackdir().
Referenced by CmdBuildSignalTrack(), and CmdRemoveSignalTrack().
static void DrawTrackBits | ( | TileInfo * | ti, | |
TrackBits | track | |||
) | [static] |
Draw ground sprite and track bits.
ti | TileInfo | |
track | TrackBits to draw |
Definition at line 1584 of file rail_cmd.cpp.
References RailtypeInfo::base_sprites, ComplementSlope(), CornerToTrackBits(), DrawGroundSprite(), FOUNDATION_NONE, FOUNDATION_STEEP_BOTH, FOUNDATION_STEEP_LOWER, GetHalftileFoundationCorner(), GetHighestSlopeCorner(), GetRailFoundation(), GetRailType(), GetRailTypeInfo(), RailtypeInfo::ground, HalftileFoundation(), IsNonContinuousFoundation(), IsSteepSlope(), IsValidCorner(), OppositeCorner(), RAIL_GROUND_BARREN, RAIL_GROUND_HALF_SNOW, RAIL_GROUND_ICE_DESERT, RAIL_GROUND_WATER, RailtypeInfo::single_e, RailtypeInfo::single_n, RailtypeInfo::single_s, RailtypeInfo::single_w, RailtypeInfo::single_x, RailtypeInfo::single_y, SLOPE_FLAT, SlopeWithThreeCornersRaised(), RailtypeInfo::snow_offset, TRACK_BIT_3WAY_NE, TRACK_BIT_3WAY_NW, TRACK_BIT_3WAY_SE, TRACK_BIT_3WAY_SW, TRACK_BIT_CROSS, TRACK_BIT_HORZ, TRACK_BIT_LEFT, TRACK_BIT_LOWER, TRACK_BIT_RIGHT, TRACK_BIT_UPPER, TRACK_BIT_VERT, TRACK_BIT_X, TRACK_BIT_Y, RailtypeInfo::track_ns, and RailtypeInfo::track_y.
Tests if a vehicle interacts with the specified track.
All track bits interact except parallel TRACK_BIT_HORZ or TRACK_BIT_VERT.
tile | The tile. | |
track | The track. |
Definition at line 108 of file rail_cmd.cpp.
References HasVehicleOnPos(), and TrackToTrackBits().
Referenced by CmdBuildSingleRail(), CmdBuildSingleSignal(), CmdRemoveSingleRail(), and CmdRemoveSingleSignal().
bool FloodHalftile | ( | TileIndex | t | ) |
Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore.
The function floods the lower halftile, if the tile has a halftile foundation.
t | The tile to flood. |
Definition at line 540 of file rail_cmd.cpp.
References CMD_REMOVE_SINGLE_RAIL, CmdFailed(), CornerToTrackBits(), DC_EXEC, DoCommand(), FIND_FIRST_BIT, GetHighestSlopeCorner(), GetRailFoundation(), GetTrackBits(), IsNonContinuousFoundation(), IsSlopeWithOneCornerRaised(), IsSlopeWithThreeCornersRaised(), IsSteepSlope(), MarkTileDirtyByTile(), OppositeCorner(), OWNER_WATER, and RAIL_GROUND_WATER.
Referenced by DoFloodTile().
Foundation GetRailFoundation | ( | Slope | tileh, | |
TrackBits | bits | |||
) |
Checks if a track combination is valid on a specific slope and returns the needed foundation.
tileh | Tile slope. | |
bits | Trackbits. |
Definition at line 198 of file rail_cmd.cpp.
References CornerToTrackBits(), FOUNDATION_INCLINED_X, FOUNDATION_INCLINED_Y, FOUNDATION_INVALID, FOUNDATION_LEVELED, FOUNDATION_NONE, FOUNDATION_STEEP_BOTH, FOUNDATION_STEEP_LOWER, GetHighestSlopeCorner(), HalftileFoundation(), IsSlopeWithOneCornerRaised(), IsSlopeWithThreeCornersRaised(), IsSteepSlope(), OppositeCorner(), SLOPE_E, SLOPE_N, SLOPE_S, SLOPE_W, SlopeWithOneCornerRaised(), SlopeWithThreeCornersRaised(), SpecialRailFoundation(), TRACK_BIT_HORZ, TRACK_BIT_LEFT, TRACK_BIT_LOWER, TRACK_BIT_NONE, TRACK_BIT_RIGHT, TRACK_BIT_UPPER, TRACK_BIT_VERT, TRACK_BIT_X, TRACK_BIT_Y, and TracksOverlap().
Referenced by CheckRailSlope(), DrawCatenaryRailway(), DrawTrackBits(), FloodHalftile(), and TestAutoslopeOnRailTile().
static uint GetSaveSlopeZ | ( | uint | x, | |
uint | y, | |||
Track | track | |||
) | [static] |
Get surface height in point (x,y) On tiles with halftile foundations move (x,y) to a save point wrt.
track
Definition at line 1407 of file rail_cmd.cpp.
References TRACK_LEFT, TRACK_LOWER, TRACK_RIGHT, and TRACK_UPPER.
static CommandCost TestAutoslopeOnRailTile | ( | TileIndex | tile, | |
uint | flags, | |||
uint | z_old, | |||
Slope | tileh_old, | |||
uint | z_new, | |||
Slope | tileh_new, | |||
TrackBits | rail_bits | |||
) | [static] |
Tests if autoslope is allowed.
tile | The tile. | |
flags | Terraform command flags. | |
z_old | Old TileZ. | |
tileh_old | Old TileSlope. | |
z_new | New TileZ. | |
tileh_new | New TileSlope. | |
rail_bits | Trackbits. |
Definition at line 2333 of file rail_cmd.cpp.
References CommandCost::AddCost(), AutoslopeEnabled(), CheckRailSlope(), CMD_ERROR, CmdFailed(), GetRailFoundation(), IsSlopeWithOneCornerRaised(), RAIL_GROUND_BARREN, RAIL_GROUND_WATER, RemoveHalftileSlope(), TRACK_BIT_LOWER, TRACK_BIT_NONE, TRACK_BIT_RIGHT, and TRACK_BIT_UPPER.
int TicksToLeaveDepot | ( | const Vehicle * | v | ) |
Compute number of ticks when next wagon will leave a depot.
Negative means next wagon should have left depot n ticks before.
v | vehicle outside (leaving) the depot |
Definition at line 2252 of file rail_cmd.cpp.
References DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, and GetRailDepotDirection().
Referenced by AdvanceWagonsAfterSwap(), and CheckTrainsLengths().
const signed char _deltacoord_leaveoffset[8] [static] |
const TileTypeProcs _tile_type_rail_procs |
Initial value:
{ DrawTile_Track, GetSlopeZ_Track, ClearTile_Track, GetAcceptedCargo_Track, GetTileDesc_Track, GetTileTrackStatus_Track, ClickTile_Track, AnimateTile_Track, TileLoop_Track, ChangeTileOwner_Track, NULL, VehicleEnter_Track, GetFoundation_Track, TerraformTile_Track, }
const byte _track_sloped_sprites[14] |
Initial value:
{ 14, 15, 22, 13, 0, 21, 17, 12, 23, 0, 18, 20, 19, 16 }
Definition at line 49 of file rail_cmd.cpp.
const TileIndexDiffC _trackdelta[] [static] |
Initial value:
{ { -1, 0 }, { 0, 1 }, { -1, 0 }, { 0, 1 }, { 1, 0 }, { 0, 1 }, { 0, 0 }, { 0, 0 }, { 1, 0 }, { 0, -1 }, { 0, -1 }, { 1, 0 }, { 0, -1 }, { -1, 0 }, { 0, 0 }, { 0, 0 } }
Definition at line 582 of file rail_cmd.cpp.
const TrackBits _valid_tracks_on_leveled_foundation[15] [static] |
Initial value:
{ TRACK_BIT_NONE, TRACK_BIT_LEFT, TRACK_BIT_LOWER, TRACK_BIT_Y | TRACK_BIT_LOWER | TRACK_BIT_LEFT, TRACK_BIT_RIGHT, TRACK_BIT_ALL, TRACK_BIT_X | TRACK_BIT_LOWER | TRACK_BIT_RIGHT, TRACK_BIT_ALL, TRACK_BIT_UPPER, TRACK_BIT_X | TRACK_BIT_UPPER | TRACK_BIT_LEFT, TRACK_BIT_ALL, TRACK_BIT_ALL, TRACK_BIT_Y | TRACK_BIT_UPPER | TRACK_BIT_RIGHT, TRACK_BIT_ALL, TRACK_BIT_ALL }
Definition at line 170 of file rail_cmd.cpp.
const TrackBits _valid_tracks_without_foundation[15] [static] |
Initial value:
{ TRACK_BIT_ALL, TRACK_BIT_RIGHT, TRACK_BIT_UPPER, TRACK_BIT_X, TRACK_BIT_LEFT, TRACK_BIT_NONE, TRACK_BIT_Y, TRACK_BIT_LOWER, TRACK_BIT_LOWER, TRACK_BIT_Y, TRACK_BIT_NONE, TRACK_BIT_LEFT, TRACK_BIT_X, TRACK_BIT_UPPER, TRACK_BIT_RIGHT, }
Definition at line 148 of file rail_cmd.cpp.