Fix catenary drawing in depots
[openttd/fttd.git] / src / elrail_func.h
blobc783865d3dded71404e3d7b6e7a33fbb274ccd25
1 /* $Id$ */
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 */
10 /** @file elrail_func.h header file for electrified rail specific functions */
12 #ifndef ELRAIL_FUNC_H
13 #define ELRAIL_FUNC_H
15 #include "rail.h"
16 #include "tile_cmd.h"
17 #include "transparency.h"
19 /**
20 * Test if a rail type has catenary
21 * @param rti Rail type to test
23 static inline bool HasRailCatenary (const RailtypeInfo *rti)
25 return HasBit (rti->flags, RTF_CATENARY);
28 /**
29 * Test if we should draw rail catenary
31 static inline bool IsCatenaryDrawn()
33 return !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails;
36 /**
37 * Test if we should draw rail catenary
38 * @param rt Rail type to test
40 static inline bool HasRailCatenaryDrawn (const RailtypeInfo *rti)
42 return HasRailCatenary (rti) && IsCatenaryDrawn();
45 void DrawRailwayCatenary (const TileInfo *ti);
47 void DrawRailBridgeHeadCatenary (const TileInfo *ti, const RailtypeInfo *rti,
48 DiagDirection dir);
50 void DrawRailAxisCatenary (const TileInfo *ti, const RailtypeInfo *rti,
51 Axis axis, bool draw_pylons = true, bool draw_wire = true);
53 void DrawRailTunnelDepotCatenary (const TileInfo *ti, const RailtypeInfo *rti,
54 bool depot, DiagDirection dir);
56 void DrawRailTunnelCatenary (const TileInfo *ti, DiagDirection dir);
58 /**
59 * Draws wires on a rail depot tile.
60 * @param ti The TileInfo to draw the wires for.
61 * @param rti The rail type information of the rail.
62 * @param dir Direction of the depot.
64 static inline void DrawRailDepotCatenary (const TileInfo *ti,
65 const RailtypeInfo *rti, DiagDirection dir)
67 DrawRailTunnelDepotCatenary (ti, rti, true, ReverseDiagDir(dir));
70 void DrawRailCatenaryOnBridge(const TileInfo *ti);
72 bool SettingsDisableElrail(int32 p1); ///< _settings_game.disable_elrail callback
74 #endif /* ELRAIL_FUNC_H */