OpenTTD
Functions
tunnelbridge_map.h File Reference

Functions that have tunnels and bridges in common. More...

#include "bridge_map.h"
#include "tunnel_map.h"

Go to the source code of this file.

Functions

static DiagDirection GetTunnelBridgeDirection (TileIndex t)
 Get the direction pointing to the other end. More...
 
static TransportType GetTunnelBridgeTransportType (TileIndex t)
 Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bridge's ramp. More...
 
static bool HasTunnelBridgeSnowOrDesert (TileIndex t)
 Tunnel: Is this tunnel entrance in a snowy or desert area? Bridge: Does the bridge ramp lie in a snow or desert area? More...
 
static void SetTunnelBridgeSnowOrDesert (TileIndex t, bool snow_or_desert)
 Tunnel: Places this tunnel entrance in a snowy or desert area, or takes it out of there. More...
 
static TileIndex GetOtherTunnelBridgeEnd (TileIndex t)
 Determines type of the wormhole and returns its other end. More...
 
static bool HasTunnelBridgeReservation (TileIndex t)
 Get the reservation state of the rail tunnel/bridge. More...
 
static void SetTunnelBridgeReservation (TileIndex t, bool b)
 Set the reservation state of the rail tunnel/bridge. More...
 
static TrackBits GetTunnelBridgeReservationTrackBits (TileIndex t)
 Get the reserved track bits for a rail tunnel/bridge. More...
 

Detailed Description

Functions that have tunnels and bridges in common.

Definition in file tunnelbridge_map.h.

Function Documentation

◆ GetOtherTunnelBridgeEnd()

static TileIndex GetOtherTunnelBridgeEnd ( TileIndex  t)
inlinestatic

Determines type of the wormhole and returns its other end.

Parameters
tone end
Precondition
IsTileType(t, MP_TUNNELBRIDGE)
Returns
other end

Definition at line 80 of file tunnelbridge_map.h.

Referenced by ClearPathReservation(), CmdConvertRail(), Train::Crash(), MarkBridgeDirty(), PlaceRail_Bridge(), PlaceRoad_Bridge(), RemoveRoad(), and YapfTrainCheckReverse().

◆ GetTunnelBridgeDirection()

static DiagDirection GetTunnelBridgeDirection ( TileIndex  t)
inlinestatic

◆ GetTunnelBridgeReservationTrackBits()

static TrackBits GetTunnelBridgeReservationTrackBits ( TileIndex  t)
inlinestatic

Get the reserved track bits for a rail tunnel/bridge.

Precondition
IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL
Parameters
tthe tile
Returns
reserved track bits

Definition at line 119 of file tunnelbridge_map.h.

References DiagDirToDiagTrackBits(), GetTunnelBridgeDirection(), HasTunnelBridgeReservation(), and TRACK_BIT_NONE.

Referenced by GetReservedTrackbits().

◆ GetTunnelBridgeTransportType()

static TransportType GetTunnelBridgeTransportType ( TileIndex  t)
inlinestatic

Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bridge's ramp.

Parameters
tThe tile to analyze
Precondition
IsTileType(t, MP_TUNNELBRIDGE)
Returns
the transport type in the tunnel/bridge

Definition at line 41 of file tunnelbridge_map.h.

Referenced by CanEnterTileOwnerCheck(), CanFollowRoad(), CmdConvertRail(), DrawBridgeMiddle(), DrawTile_TunnelBridge(), GetAnyRoadBits(), GetRailTrackBitsUniversal(), GetReservedTrackbits(), SmallMapWindow::GetTileColours(), GetTileRailType(), and RemoveRoad().

◆ HasTunnelBridgeReservation()

static bool HasTunnelBridgeReservation ( TileIndex  t)
inlinestatic

Get the reservation state of the rail tunnel/bridge.

Precondition
IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL
Parameters
tthe tile
Returns
reservation state

Definition at line 93 of file tunnelbridge_map.h.

Referenced by CmdConvertRail(), and GetTunnelBridgeReservationTrackBits().

◆ HasTunnelBridgeSnowOrDesert()

static bool HasTunnelBridgeSnowOrDesert ( TileIndex  t)
inlinestatic

Tunnel: Is this tunnel entrance in a snowy or desert area? Bridge: Does the bridge ramp lie in a snow or desert area?

Parameters
tThe tile to analyze
Precondition
IsTileType(t, MP_TUNNELBRIDGE)
Returns
true if and only if the tile is in a snowy/desert area

Definition at line 54 of file tunnelbridge_map.h.

◆ SetTunnelBridgeReservation()

static void SetTunnelBridgeReservation ( TileIndex  t,
bool  b 
)
inlinestatic

Set the reservation state of the rail tunnel/bridge.

Precondition
IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL
Parameters
tthe tile
bthe reservation state

Definition at line 106 of file tunnelbridge_map.h.

Referenced by ClearPathReservation(), and Train::Crash().

◆ SetTunnelBridgeSnowOrDesert()

static void SetTunnelBridgeSnowOrDesert ( TileIndex  t,
bool  snow_or_desert 
)
inlinestatic

Tunnel: Places this tunnel entrance in a snowy or desert area, or takes it out of there.

Bridge: Sets whether the bridge ramp lies in a snow or desert area.

Parameters
tthe tunnel entrance / bridge ramp tile
snow_or_desertis the entrance/ramp in snow or desert (true), when not in snow and not in desert false
Precondition
IsTileType(t, MP_TUNNELBRIDGE)

Definition at line 68 of file tunnelbridge_map.h.