src/elrail_func.h
author rubidium
Fri, 18 Jul 2008 12:20:31 +0000
changeset 11171 04fc8e49df1b
parent 10775 7061477bfbcf
permissions -rw-r--r--
(svn r13729) -Fix: assumption that non-north tiles of a house do not have the 1x1 building bit set was flawed with some NewGRFs. This caused the amount of houses to differ, which causes the town radii to differ, which causes desyncs when towns are expanded.
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
{
10775
7061477bfbcf (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: 10703
diff changeset
    28
	return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings_game.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
10775
7061477bfbcf (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: 10703
diff changeset
    40
int32 SettingsDisableElrail(int32 p1); ///< _settings_game.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 */