OpenTTD Source: src/elrail_func.h Source File

OpenTTD Source 15.3

elrail_func.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef ELRAIL_FUNC_H
11#define ELRAIL_FUNC_H
12
13#include "rail.h"
14#include "tile_cmd.h"
15#include "transparency.h"
16
21 inline bool HasRailCatenary(RailType rt)
22{
23 return GetRailTypeInfo(rt)->flags.Test(RailTypeFlag::Catenary);
24}
25
30 inline bool HasRailCatenaryDrawn(RailType rt)
31{
32 return HasRailCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails;
33}
34
35void DrawRailCatenary(const TileInfo *ti);
36void DrawRailCatenaryOnTunnel(const TileInfo *ti);
37void DrawRailCatenaryOnBridge(const TileInfo *ti);
38
39void SettingsDisableElrail(int32_t new_value);
40void UpdateDisableElrailSettingState(bool disable, bool update_vehicles);
41
42#endif /* ELRAIL_FUNC_H */
BaseBitSet::Test
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
Definition base_bitset_type.hpp:141
RailTypeInfo::flags
RailTypeFlags flags
Bit mask of rail type flags.
Definition rail.h:200
SettingsDisableElrail
void SettingsDisableElrail(int32_t new_value)
_settings_game.disable_elrail callback
Definition elrail.cpp:575
DrawRailCatenaryOnBridge
void DrawRailCatenaryOnBridge(const TileInfo *ti)
Draws wires on a tunnel tile.
Definition elrail.cpp:490
HasRailCatenary
bool HasRailCatenary(RailType rt)
Test if a rail type has catenary.
Definition elrail_func.h:21
DrawRailCatenaryOnTunnel
void DrawRailCatenaryOnTunnel(const TileInfo *ti)
Draws wires on a tunnel tile.
Definition elrail.cpp:249
DrawRailCatenary
void DrawRailCatenary(const TileInfo *ti)
Draws overhead wires and pylons for electric railways.
Definition elrail.cpp:550
HasRailCatenaryDrawn
bool HasRailCatenaryDrawn(RailType rt)
Test if we should draw rail catenary.
Definition elrail_func.h:30
rail.h
Rail specific functions.
GetRailTypeInfo
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
Definition rail.h:300
RailTypeFlag::Catenary
@ Catenary
Bit number for drawing a catenary.
RailType
RailType
Enumeration for all possible railtypes.
Definition rail_type.h:25
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:61
GameSettings::vehicle
VehicleSettings vehicle
options for vehicles
Definition settings_type.h:641
TileInfo
Tile information, used while rendering the tile.
Definition tile_cmd.h:30
VehicleSettings::disable_elrails
bool disable_elrails
when true, the elrails are disabled
Definition settings_type.h:525
tile_cmd.h
Generic 'commands' that can be performed on all tiles.
transparency.h
Functions related to transparency.
IsInvisibilitySet
bool IsInvisibilitySet(TransparencyOption to)
Check if the invisibility option bit is set and if we aren't in the game menu (there's never transpar...
Definition transparency.h:61
TO_CATENARY
@ TO_CATENARY
catenary
Definition transparency.h:31