OpenTTD

elrail_func.h
Go to the documentation of this file.
1 /* $Id: elrail_func.h 27676 2016-11-05 11:53:03Z frosch $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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 <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef ELRAIL_FUNC_H
13 #define ELRAIL_FUNC_H
14
15 #include "rail.h"
16 #include "tile_cmd.h"
17 #include "transparency.h"
18
23 static inline bool HasRailCatenary(RailType rt)
24 {
25 return HasBit(GetRailTypeInfo(rt)->flags, RTF_CATENARY);
26 }
27
32 static inline bool HasRailCatenaryDrawn(RailType rt)
33 {
34 return HasRailCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails;
35 }
36
37 void DrawRailCatenary(const TileInfo *ti);
38 void DrawRailCatenaryOnTunnel(const TileInfo *ti);
39 void DrawRailCatenaryOnBridge(const TileInfo *ti);
40
41 bool SettingsDisableElrail(int32 p1);
42
43 #endif /* ELRAIL_FUNC_H */
VehicleSettings::disable_elrails
bool disable_elrails
when true, the elrails are disabled
Definition: settings_type.h:454
GameSettings::vehicle
VehicleSettings vehicle
options for vehicles
Definition: settings_type.h:552
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:77
GetRailTypeInfo
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
Definition: rail.h:296
TileInfo
Tile information, used while rendering the tile.
Definition: tile_cmd.h:44
RailType
RailType
Enumeration for all possible railtypes.
Definition: rail_type.h:29
rail.h
Rail specific functions.
DrawRailCatenaryOnBridge
void DrawRailCatenaryOnBridge(const TileInfo *ti)
Draws wires on a tunnel tile.
Definition: elrail.cpp:502
SettingsDisableElrail
bool SettingsDisableElrail(int32 p1)
_settings_game.disable_elrail callback
Definition: elrail.cpp:594
RTF_CATENARY
Bit number for drawing a catenary.
Definition: rail.h:27
HasRailCatenary
static bool HasRailCatenary(RailType rt)
Test if a rail type has catenary.
Definition: elrail_func.h:23
TO_CATENARY
catenary
Definition: transparency.h:32
DrawRailCatenaryOnTunnel
void DrawRailCatenaryOnTunnel(const TileInfo *ti)
Draws wires on a tunnel tile.
Definition: elrail.cpp:245
DrawRailCatenary
void DrawRailCatenary(const TileInfo *ti)
Draws overhead wires and pylons for electric railways.
Definition: elrail.cpp:564
transparency.h
Functions related to transparency.
HasRailCatenaryDrawn
static bool HasRailCatenaryDrawn(RailType rt)
Test if we should draw rail catenary.
Definition: elrail_func.h:32
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:105
IsInvisibilitySet
static bool IsInvisibilitySet(TransparencyOption to)
Check if the invisibility option bit is set and if we aren&#39;t in the game menu (there&#39;s never transpar...
Definition: transparency.h:61
tile_cmd.h
Generic &#39;commands&#39; that can be performed on all tiles.