OpenTTD Source: src/elrail_func.h File Reference

OpenTTD Source 15.0-RC2

Functions
elrail_func.h File Reference

header file for electrified rail specific functions More...

`#include "rail.h"`
`#include "tile_cmd.h"`
`#include "transparency.h"`

Go to the source code of this file.

## Functions
bool | HasRailCatenary (RailType rt)
| Test if a rail type has catenary.
bool | HasRailCatenaryDrawn (RailType rt)
| Test if we should draw rail catenary.
void | DrawRailCatenary (const TileInfo *ti)
| Draws overhead wires and pylons for electric railways.
void | DrawRailCatenaryOnTunnel (const TileInfo *ti)
| Draws wires on a tunnel tile.
void | DrawRailCatenaryOnBridge (const TileInfo *ti)
| Draws wires on a tunnel tile.
void | SettingsDisableElrail (int32_t new_value)
| _settings_game.disable_elrail callback
void | UpdateDisableElrailSettingState (bool disable, bool update_vehicles)

## Detailed Description

header file for electrified rail specific functions

Definition in file elrail_func.h.

## Function Documentation

## ◆ DrawRailCatenary()

void DrawRailCatenary | ( | const TileInfo * | ti | ) |

Draws overhead wires and pylons for electric railways.

Parameters

  ti | The TileInfo struct of the tile being drawn

See also
  DrawRailCatenaryRailway

Definition at line 550 of file elrail.cpp.

References AddSortableSpriteToDraw(), DrawRailCatenaryRailway(), GetRailDepotDirection(), GetTileMaxPixelZ(), GetTileType(), GetWireBase(), IsRailDepot(), IsTransparencySet(), MP_RAILWAY, MP_ROAD, MP_STATION, MP_TUNNELBRIDGE, TileInfo::tile, TO_CATENARY, Coord3D< T >::x, and Coord3D< T >::y.

Referenced by DrawTile_Road(), and DrawTile_TunnelBridge().

## ◆ DrawRailCatenaryOnBridge()

void DrawRailCatenaryOnBridge | ( | const TileInfo * | ti | ) |

Draws wires on a tunnel tile.

DrawTile_TunnelBridge() calls this function to draw the wires on the bridge.

Parameters

  ti | The Tileinfo to draw the tile for

Definition at line 490 of file elrail.cpp.

References AddSortableSpriteToDraw(), AXIS_X, BB_HEIGHT_UNDER_BRIDGE, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, DIR_NE, DIR_NW, GetBridgeAxis(), GetBridgePixelHeight(), GetOtherBridgeEnd(), GetPylonBase(), GetSouthernBridgeEnd(), GetTileLocationGroup(), GetTunnelBridgeLength(), GetWireBase(), HasBit(), IsTransparencySet(), ReverseDir(), TCX_ON_BRIDGE, TileInfo::tile, TO_CATENARY, Coord3D< T >::x, and Coord3D< T >::y.

Referenced by DrawBridgeMiddle().

## ◆ DrawRailCatenaryOnTunnel()

void DrawRailCatenaryOnTunnel | ( | const TileInfo * | ti | ) |

Draws wires on a tunnel tile.

DrawTile_TunnelBridge() calls this function to draw the wires as SpriteCombine with the tunnel roof.

Parameters

  ti | The Tileinfo to draw the tile for

Definition at line 249 of file elrail.cpp.

References AddSortableSpriteToDraw(), GetTilePixelZ(), GetTunnelBridgeDirection(), GetWireBase(), IsTransparencySet(), TileInfo::tile, TO_CATENARY, Coord3D< T >::x, and Coord3D< T >::y.

Referenced by DrawTile_TunnelBridge().

## ◆ HasRailCatenary()

bool HasRailCatenary | ( | RailType | rt | ) |
| inline

Test if a rail type has catenary.

Parameters

  rt | Rail type to test

Definition at line 21 of file elrail_func.h.

References Catenary, RailTypeInfo::flags, GetRailTypeInfo(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().

Referenced by DrawRailCatenaryRailway(), GetRailTrackBitsUniversal(), HasRailCatenaryDrawn(), and MaskWireBits().

## ◆ HasRailCatenaryDrawn()

bool HasRailCatenaryDrawn | ( | RailType | rt | ) |
| inline

Test if we should draw rail catenary.

Parameters

  rt | Rail type to test

Definition at line 30 of file elrail_func.h.

References _settings_game, VehicleSettings::disable_elrails, HasRailCatenary(), IsInvisibilitySet(), TO_CATENARY, and GameSettings::vehicle.

Referenced by DrawBridgeMiddle(), DrawTile_Road(), and DrawTile_TunnelBridge().

## ◆ SettingsDisableElrail()

void SettingsDisableElrail | ( | int32_t | new_value | ) |

_settings_game.disable_elrail callback

Definition at line 575 of file elrail.cpp.

## ◆ UpdateDisableElrailSettingState()

void UpdateDisableElrailSettingState | ( | bool | disable,
|  | bool | update_vehicles
| ) |  |

Definition at line 581 of file elrail.cpp.