src/elrail_func.h
author skidd13
Wed, 28 May 2008 16:50:05 +0000
changeset 10762 ad9b3f3325cf
parent 10703 2c998f3776d1
child 10775 7061477bfbcf
permissions -rw-r--r--
(svn r13312) -Update: apply english.txt changes from r13311 to other languages
10473
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     1
/* $Id$ */
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     2
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     3
/** @file elrail_func.h header file for electrified rail specific functions */
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     4
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     5
#ifndef ELRAIL_FUNC_H
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     6
#define ELRAIL_FUNC_H
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     7
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     8
#include "rail.h"
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     9
#include "transparency.h"
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    10
#include "tile_cmd.h"
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    11
#include "settings_type.h"
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    12
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    13
/**
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    14
 * Test if a rail type has catenary
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    15
 * @param rt Rail type to test
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    16
 */
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    17
static inline bool HasCatenary(RailType rt)
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    18
{
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    19
	return HasBit(GetRailTypeInfo(rt)->flags, RTF_CATENARY);
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    20
}
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    21
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    22
/**
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    23
 * Test if we should draw rail catenary
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    24
 * @param rt Rail type to test
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    25
 */
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    26
static inline bool HasCatenaryDrawn(RailType rt)
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    27
{
10703
2c998f3776d1 (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents: 10473
diff changeset
    28
	return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings.vehicle.disable_elrails;
10473
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    29
}
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    30
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    31
/**
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    32
 * Draws overhead wires and pylons for electric railways.
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    33
 * @param ti The TileInfo struct of the tile being drawn
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    34
 * @see DrawCatenaryRailway
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    35
 */
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    36
void DrawCatenary(const TileInfo *ti);
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    37
void DrawCatenaryOnTunnel(const TileInfo *ti);
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    38
void DrawCatenaryOnBridge(const TileInfo *ti);
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    39
10703
2c998f3776d1 (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium
parents: 10473
diff changeset
    40
int32 SettingsDisableElrail(int32 p1); ///< _settings.disable_elrail callback
10473
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    41
ad730880e443 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    42
#endif /* ELRAIL_FUNC_H */