diff options
author | smatz <smatz@openttd.org> | 2008-05-08 16:48:29 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-05-08 16:48:29 +0000 |
commit | 386a3f1d208a67af646da9a0bedba375858f822c (patch) | |
tree | 4102a7e524984bc47f14e70bc388938ea0c957c7 /src/elrail_func.h | |
parent | 4a11ebe76fcaba45954aa2b6f29e6e75a8c30942 (diff) | |
download | openttd-386a3f1d208a67af646da9a0bedba375858f822c.tar.xz |
(svn r13016) -Codechange: unify the detection if rail catenary should be drawn
Diffstat (limited to 'src/elrail_func.h')
-rw-r--r-- | src/elrail_func.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/elrail_func.h b/src/elrail_func.h new file mode 100644 index 000000000..c65be6fa5 --- /dev/null +++ b/src/elrail_func.h @@ -0,0 +1,42 @@ +/* $Id$ */ + +/** @file elrail_func.h header file for electrified rail specific functions */ + +#ifndef ELRAIL_FUNC_H +#define ELRAIL_FUNC_H + +#include "rail.h" +#include "transparency.h" +#include "tile_cmd.h" +#include "settings_type.h" + +/** + * Test if a rail type has catenary + * @param rt Rail type to test + */ +static inline bool HasCatenary(RailType rt) +{ + return HasBit(GetRailTypeInfo(rt)->flags, RTF_CATENARY); +} + +/** + * Test if we should draw rail catenary + * @param rt Rail type to test + */ +static inline bool HasCatenaryDrawn(RailType rt) +{ + return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_patches.disable_elrails; +} + +/** + * Draws overhead wires and pylons for electric railways. + * @param ti The TileInfo struct of the tile being drawn + * @see DrawCatenaryRailway + */ +void DrawCatenary(const TileInfo *ti); +void DrawCatenaryOnTunnel(const TileInfo *ti); +void DrawCatenaryOnBridge(const TileInfo *ti); + +int32 SettingsDisableElrail(int32 p1); ///< _patches.disable_elrail callback + +#endif /* ELRAIL_FUNC_H */ |