src/elrail_func.h
author rubidium
Thu, 18 Dec 2008 12:23:08 +0000
changeset 10436 8d3a9fbe8f19
parent 9413 7042a8ec3fa8
permissions -rw-r--r--
(svn r14689) -Change: make configure die on commonly made user mistakes, like not having SDL development files or zlib headers installed; you can still compile a dedicated server or a binary without zlib, but you have to explicitly force it.
9154
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     1
/* $Id$ */
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     2
2c042b567165 (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 */
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     4
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     5
#ifndef ELRAIL_FUNC_H
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     6
#define ELRAIL_FUNC_H
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     7
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     8
#include "rail.h"
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
     9
#include "transparency.h"
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    10
#include "tile_cmd.h"
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    11
#include "settings_type.h"
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    12
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    13
/**
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    14
 * Test if a rail type has catenary
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    15
 * @param rt Rail type to test
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    16
 */
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    17
static inline bool HasCatenary(RailType rt)
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    18
{
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    19
	return HasBit(GetRailTypeInfo(rt)->flags, RTF_CATENARY);
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    20
}
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    21
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    22
/**
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    23
 * Test if we should draw rail catenary
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    24
 * @param rt Rail type to test
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    25
 */
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    26
static inline bool HasCatenaryDrawn(RailType rt)
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    27
{
9413
7042a8ec3fa8 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents: 9354
diff changeset
    28
	return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails;
9154
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    29
}
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    30
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    31
/**
2c042b567165 (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.
2c042b567165 (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
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    34
 * @see DrawCatenaryRailway
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    35
 */
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    36
void DrawCatenary(const TileInfo *ti);
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    37
void DrawCatenaryOnTunnel(const TileInfo *ti);
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    38
void DrawCatenaryOnBridge(const TileInfo *ti);
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    39
9413
7042a8ec3fa8 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents: 9354
diff changeset
    40
int32 SettingsDisableElrail(int32 p1); ///< _settings_game.disable_elrail callback
9154
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    41
2c042b567165 (svn r13016) -Codechange: unify the detection if rail catenary should be drawn
smatz
parents:
diff changeset
    42
#endif /* ELRAIL_FUNC_H */