rail_map.h
author glx
Mon, 24 Sep 2007 03:08:47 +0000
branch0.5
changeset 5545 f42dc59a45f5
parent 4666 850b5b6e4bac
child 5573 afa6f92a71fd
permissions -rw-r--r--
(svn r11153) [0.5] -Fix [FS#1251]: incorrect usage of {G} tag in slovak translation
3101
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
     1
/* $Id$ */
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
     2
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
     3
#ifndef RAIL_MAP_H
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
     4
#define RAIL_MAP_H
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
     5
3239
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
     6
#include "direction.h"
4041
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
     7
#include "rail.h"
3101
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
     8
#include "tile.h"
3239
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
     9
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    10
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    11
typedef enum RailTileType {
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    12
	RAIL_TILE_NORMAL         = 0x0,
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    13
	RAIL_TILE_SIGNALS        = 0x40,
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    14
	RAIL_TILE_UNUSED         = 0x80, /* XXX: Maybe this could become waypoints? */
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    15
	RAIL_TILE_DEPOT_WAYPOINT = 0xC0, /* Is really depots and waypoints... */
3239
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    16
	RAIL_TILE_TYPE_MASK      = 0xC0
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    17
} RailTileType;
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    18
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    19
static inline RailTileType GetRailTileType(TileIndex t)
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    20
{
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    21
	assert(IsTileType(t, MP_RAILWAY));
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3792
diff changeset
    22
	return (RailTileType)(_m[t].m5 & RAIL_TILE_TYPE_MASK);
3239
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    23
}
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    24
3772
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    25
/**
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    26
 * Returns whether this is plain rails, with or without signals. Iow, if this
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    27
 * tiles RailTileType is RAIL_TILE_NORMAL or RAIL_TILE_SIGNALS.
3772
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    28
 */
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    29
static inline bool IsPlainRailTile(TileIndex tile)
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    30
{
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    31
	RailTileType rtt = GetRailTileType(tile);
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    32
	return rtt == RAIL_TILE_NORMAL || rtt == RAIL_TILE_SIGNALS;
3772
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    33
}
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    34
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    35
/**
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    36
 * Checks if a rail tile has signals.
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    37
 */
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    38
static inline bool HasSignals(TileIndex tile)
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    39
{
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    40
	return GetRailTileType(tile) == RAIL_TILE_SIGNALS;
3772
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    41
}
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    42
3239
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    43
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    44
/** These specify the subtype when the main rail type is
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    45
 * RAIL_TILE_DEPOT_WAYPOINT */
3239
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    46
typedef enum RailTileSubtypes {
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    47
	RAIL_SUBTYPE_DEPOT    = 0x00,
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    48
	RAIL_SUBTYPE_WAYPOINT = 0x04,
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    49
	RAIL_SUBTYPE_MASK     = 0x3C
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    50
} RailTileSubtype;
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    51
3772
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    52
/**
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    53
 * Returns the RailTileSubtype of a given rail tile with type
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    54
 * RAIL_TILE_DEPOT_WAYPOINT
3772
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    55
 */
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    56
static inline RailTileSubtype GetRailTileSubtype(TileIndex tile)
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    57
{
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
    58
	assert(GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT);
3772
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    59
	return (RailTileSubtype)(_m[tile].m5 & RAIL_SUBTYPE_MASK);
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    60
}
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
    61
3239
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    62
4182
20d711816338 (svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes
tron
parents: 4158
diff changeset
    63
static inline bool IsRailDepot(TileIndex t)
20d711816338 (svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes
tron
parents: 4158
diff changeset
    64
{
20d711816338 (svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes
tron
parents: 4158
diff changeset
    65
	return
20d711816338 (svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes
tron
parents: 4158
diff changeset
    66
		GetRailTileType(t) == RAIL_TILE_DEPOT_WAYPOINT &&
20d711816338 (svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes
tron
parents: 4158
diff changeset
    67
		GetRailTileSubtype(t) == RAIL_SUBTYPE_DEPOT;
20d711816338 (svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes
tron
parents: 4158
diff changeset
    68
}
20d711816338 (svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes
tron
parents: 4158
diff changeset
    69
20d711816338 (svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes
tron
parents: 4158
diff changeset
    70
4044
37822ac6f431 (svn r5313) Move IsRailWaypoint() to rail_map.h and remove unused enum
tron
parents: 4041
diff changeset
    71
static inline bool IsRailWaypoint(TileIndex t)
37822ac6f431 (svn r5313) Move IsRailWaypoint() to rail_map.h and remove unused enum
tron
parents: 4041
diff changeset
    72
{
37822ac6f431 (svn r5313) Move IsRailWaypoint() to rail_map.h and remove unused enum
tron
parents: 4041
diff changeset
    73
	return
37822ac6f431 (svn r5313) Move IsRailWaypoint() to rail_map.h and remove unused enum
tron
parents: 4041
diff changeset
    74
		GetRailTileType(t) == RAIL_TILE_DEPOT_WAYPOINT &&
37822ac6f431 (svn r5313) Move IsRailWaypoint() to rail_map.h and remove unused enum
tron
parents: 4041
diff changeset
    75
		GetRailTileSubtype(t) == RAIL_SUBTYPE_WAYPOINT;
37822ac6f431 (svn r5313) Move IsRailWaypoint() to rail_map.h and remove unused enum
tron
parents: 4041
diff changeset
    76
}
37822ac6f431 (svn r5313) Move IsRailWaypoint() to rail_map.h and remove unused enum
tron
parents: 4041
diff changeset
    77
37822ac6f431 (svn r5313) Move IsRailWaypoint() to rail_map.h and remove unused enum
tron
parents: 4041
diff changeset
    78
3239
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    79
static inline RailType GetRailType(TileIndex t)
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    80
{
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    81
	return (RailType)GB(_m[t].m3, 0, 4);
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    82
}
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
    83
3242
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    84
// TODO remove this by moving to the same bits as GetRailType()
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    85
static inline RailType GetRailTypeCrossing(TileIndex t)
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    86
{
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    87
	return (RailType)GB(_m[t].m4, 0, 4);
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    88
}
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    89
3977
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
    90
static inline RailType GetRailTypeOnBridge(TileIndex t)
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
    91
{
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
    92
	return (RailType)GB(_m[t].m3, 4, 4);
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
    93
}
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
    94
3242
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    95
static inline void SetRailType(TileIndex t, RailType r)
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    96
{
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    97
	SB(_m[t].m3, 0, 4, r);
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    98
}
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
    99
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
   100
// TODO remove this by moving to the same bits as SetRailType()
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
   101
static inline void SetRailTypeCrossing(TileIndex t, RailType r)
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
   102
{
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
   103
	SB(_m[t].m4, 0, 4, r);
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
   104
}
1cefa03f0d5e (svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents: 3239
diff changeset
   105
3977
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
   106
static inline void SetRailTypeOnBridge(TileIndex t, RailType r)
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
   107
{
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
   108
	SB(_m[t].m3, 4, 4, r);
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
   109
}
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3933
diff changeset
   110
3239
45396b9950aa (svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents: 3238
diff changeset
   111
3267
591027d10884 (svn r3979) Move GetRailFoundation() to rail_map.h and use it and friends to get information about rail tiles
tron
parents: 3258
diff changeset
   112
static inline TrackBits GetTrackBits(TileIndex tile)
591027d10884 (svn r3979) Move GetRailFoundation() to rail_map.h and use it and friends to get information about rail tiles
tron
parents: 3258
diff changeset
   113
{
591027d10884 (svn r3979) Move GetRailFoundation() to rail_map.h and use it and friends to get information about rail tiles
tron
parents: 3258
diff changeset
   114
	return (TrackBits)GB(_m[tile].m5, 0, 6);
591027d10884 (svn r3979) Move GetRailFoundation() to rail_map.h and use it and friends to get information about rail tiles
tron
parents: 3258
diff changeset
   115
}
591027d10884 (svn r3979) Move GetRailFoundation() to rail_map.h and use it and friends to get information about rail tiles
tron
parents: 3258
diff changeset
   116
3273
7303df652359 (svn r3985) Make CmdBuildSingleRail() a bit more comprehensible
tron
parents: 3267
diff changeset
   117
static inline void SetTrackBits(TileIndex t, TrackBits b)
7303df652359 (svn r3985) Make CmdBuildSingleRail() a bit more comprehensible
tron
parents: 3267
diff changeset
   118
{
7303df652359 (svn r3985) Make CmdBuildSingleRail() a bit more comprehensible
tron
parents: 3267
diff changeset
   119
	SB(_m[t].m5, 0, 6, b);
7303df652359 (svn r3985) Make CmdBuildSingleRail() a bit more comprehensible
tron
parents: 3267
diff changeset
   120
}
7303df652359 (svn r3985) Make CmdBuildSingleRail() a bit more comprehensible
tron
parents: 3267
diff changeset
   121
3772
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
   122
/**
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
   123
 * Returns whether the given track is present on the given tile. Tile must be
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
   124
 * a plain rail tile (IsPlainRailTile()).
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
   125
 */
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
   126
static inline bool HasTrack(TileIndex tile, Track track)
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
   127
{
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
   128
	return HASBIT(GetTrackBits(tile), track);
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
   129
}
4872d75f5172 (svn r4764) Move some functions from rail.h to rail_map.h
tron
parents: 3575
diff changeset
   130
3101
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   131
3185
c0ef161f700f (svn r3831) Add and use GetRailDepotDirection()
tron
parents: 3102
diff changeset
   132
static inline DiagDirection GetRailDepotDirection(TileIndex t)
c0ef161f700f (svn r3831) Add and use GetRailDepotDirection()
tron
parents: 3102
diff changeset
   133
{
c0ef161f700f (svn r3831) Add and use GetRailDepotDirection()
tron
parents: 3102
diff changeset
   134
	return (DiagDirection)GB(_m[t].m5, 0, 2);
c0ef161f700f (svn r3831) Add and use GetRailDepotDirection()
tron
parents: 3102
diff changeset
   135
}
c0ef161f700f (svn r3831) Add and use GetRailDepotDirection()
tron
parents: 3102
diff changeset
   136
4158
a8f7265a6fd0 (svn r5582) Add and use AxisToTrack{Bits,}()
tron
parents: 4077
diff changeset
   137
a8f7265a6fd0 (svn r5582) Add and use AxisToTrack{Bits,}()
tron
parents: 4077
diff changeset
   138
static inline Axis GetWaypointAxis(TileIndex t)
a8f7265a6fd0 (svn r5582) Add and use AxisToTrack{Bits,}()
tron
parents: 4077
diff changeset
   139
{
4474
0f8f3a3d6768 (svn r6259) Extract the axis directly, don't use a trinary operator
tron
parents: 4466
diff changeset
   140
	return (Axis)GB(_m[t].m5, 0, 1);
4158
a8f7265a6fd0 (svn r5582) Add and use AxisToTrack{Bits,}()
tron
parents: 4077
diff changeset
   141
}
a8f7265a6fd0 (svn r5582) Add and use AxisToTrack{Bits,}()
tron
parents: 4077
diff changeset
   142
3453
4de28826442c (svn r4286) -Fix: Typo in 4280
celestar
parents: 3448
diff changeset
   143
static inline Track GetRailWaypointTrack(TileIndex t)
3448
0bee5179ae86 (svn r4280) -Codechange: Add and make use of map accessors concerning railway waypoints
celestar
parents: 3355
diff changeset
   144
{
4158
a8f7265a6fd0 (svn r5582) Add and use AxisToTrack{Bits,}()
tron
parents: 4077
diff changeset
   145
	return AxisToTrack(GetWaypointAxis(t));
3448
0bee5179ae86 (svn r4280) -Codechange: Add and make use of map accessors concerning railway waypoints
celestar
parents: 3355
diff changeset
   146
}
3185
c0ef161f700f (svn r3831) Add and use GetRailDepotDirection()
tron
parents: 3102
diff changeset
   147
3101
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   148
static inline TrackBits GetRailWaypointBits(TileIndex t)
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   149
{
4158
a8f7265a6fd0 (svn r5582) Add and use AxisToTrack{Bits,}()
tron
parents: 4077
diff changeset
   150
	return TrackToTrackBits(GetRailWaypointTrack(t));
3528
ca3ce10452d8 (svn r4384) -Codechange: rail drawing code
celestar
parents: 3523
diff changeset
   151
}
ca3ce10452d8 (svn r4384) -Codechange: rail drawing code
celestar
parents: 3523
diff changeset
   152
3101
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   153
3238
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   154
typedef enum SignalType {
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   155
	SIGTYPE_NORMAL  = 0, // normal signal
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   156
	SIGTYPE_ENTRY   = 1, // presignal block entry
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   157
	SIGTYPE_EXIT    = 2, // presignal block exit
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   158
	SIGTYPE_COMBO   = 3  // presignal inter-block
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   159
} SignalType;
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   160
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   161
static inline SignalType GetSignalType(TileIndex t)
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   162
{
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
   163
	assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
3238
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   164
	return (SignalType)GB(_m[t].m4, 0, 2);
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   165
}
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   166
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   167
static inline void SetSignalType(TileIndex t, SignalType s)
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   168
{
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
   169
	assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
3238
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   170
	SB(_m[t].m4, 0, 2, s);
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   171
}
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   172
3521
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   173
static inline bool IsPresignalEntry(TileIndex t)
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   174
{
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   175
	return GetSignalType(t) == SIGTYPE_ENTRY || GetSignalType(t) == SIGTYPE_COMBO;
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   176
}
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   177
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   178
static inline bool IsPresignalExit(TileIndex t)
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   179
{
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   180
	return GetSignalType(t) == SIGTYPE_EXIT || GetSignalType(t) == SIGTYPE_COMBO;
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   181
}
c5dda2dbd977 (svn r4377) -Add and make use of a function that finds out whether a signal is an entry or and exit signal to a presignal block (as combos act as both)
celestar
parents: 3453
diff changeset
   182
3522
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   183
static inline void CycleSignalSide(TileIndex t, Track track)
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   184
{
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   185
	byte sig;
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   186
	byte pos = 6;
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   187
	if (track == TRACK_LOWER || track == TRACK_RIGHT) pos = 4;
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   188
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   189
	sig = GB(_m[t].m3, pos, 2);
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   190
	if (--sig == 0) sig = 3;
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   191
	SB(_m[t].m3, pos, 2, sig);
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   192
}
25ce619b9a19 (svn r4378) -Add and make use of an accessor function two-way => one-way => one-way => two-way signal cycling
celestar
parents: 3521
diff changeset
   193
3238
a100405fe221 (svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents: 3237
diff changeset
   194
3237
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   195
typedef enum SignalVariant {
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   196
	SIG_ELECTRIC  = 0,
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   197
	SIG_SEMAPHORE = 1
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   198
} SignalVariant;
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   199
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   200
static inline SignalVariant GetSignalVariant(TileIndex t)
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   201
{
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   202
	return (SignalVariant)GB(_m[t].m4, 2, 1);
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   203
}
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   204
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   205
static inline void SetSignalVariant(TileIndex t, SignalVariant v)
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   206
{
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   207
	SB(_m[t].m4, 2, 1, v);
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   208
}
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   209
3575
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   210
static inline bool IsSignalPresent(TileIndex t, byte signalbit)
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   211
{
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   212
	return HASBIT(_m[t].m3, signalbit + 4);
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   213
}
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   214
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   215
/** These are states in which a signal can be. Currently these are only two, so
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   216
 * simple boolean logic will do. But do try to compare to this enum instead of
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   217
 * normal boolean evaluation, since that will make future additions easier.
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   218
 */
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   219
typedef enum SignalStates {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   220
	SIGNAL_STATE_RED   = 0,
3575
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   221
	SIGNAL_STATE_GREEN = 1,
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   222
} SignalState;
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   223
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   224
static inline SignalState GetSingleSignalState(TileIndex t, byte signalbit)
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   225
{
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3792
diff changeset
   226
	return (SignalState)HASBIT(_m[t].m2, signalbit + 4);
3575
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   227
}
867df1ec208a (svn r4461) -Codechange: Add and make use of map accessor functions for signal drawing. Includes some basic cleanup of the drawing functions
celestar
parents: 3530
diff changeset
   228
3237
985399d4099d (svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents: 3185
diff changeset
   229
4041
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   230
/**
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   231
 * Checks for the presence of signals (either way) on the given track on the
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   232
 * given rail tile.
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   233
 */
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   234
static inline bool HasSignalOnTrack(TileIndex tile, Track track)
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   235
{
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   236
	assert(IsValidTrack(track));
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   237
	return
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   238
		GetRailTileType(tile) == RAIL_TILE_SIGNALS &&
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   239
		(_m[tile].m3 & SignalOnTrack(track)) != 0;
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   240
}
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   241
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   242
/**
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   243
 * Checks for the presence of signals along the given trackdir on the given
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   244
 * rail tile.
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   245
 *
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   246
 * Along meaning if you are currently driving on the given trackdir, this is
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   247
 * the signal that is facing us (for which we stop when it's red).
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   248
 */
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   249
static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   250
{
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   251
	assert (IsValidTrackdir(trackdir));
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   252
	return
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   253
		GetRailTileType(tile) == RAIL_TILE_SIGNALS &&
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   254
		_m[tile].m3 & SignalAlongTrackdir(trackdir);
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   255
}
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   256
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   257
/**
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   258
 * Gets the state of the signal along the given trackdir.
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   259
 *
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   260
 * Along meaning if you are currently driving on the given trackdir, this is
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   261
 * the signal that is facing us (for which we stop when it's red).
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   262
 */
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   263
static inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir)
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   264
{
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   265
	assert(IsValidTrackdir(trackdir));
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   266
	assert(HasSignalOnTrack(tile, TrackdirToTrack(trackdir)));
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   267
	return _m[tile].m2 & SignalAlongTrackdir(trackdir) ?
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   268
		SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   269
}
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   270
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   271
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   272
/**
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   273
 * Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   274
 * Note that there is no check if the given trackdir is actually present on
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   275
 * the tile!
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   276
 * The given trackdir is used when there are (could be) multiple rail types on
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   277
 * one tile.
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   278
 */
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   279
RailType GetTileRailType(TileIndex tile, Trackdir trackdir);
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   280
caf4fcb4e05b (svn r5309) Partially fix the rail header dependency fiasco: rail_map.h now depends on rail.h and not the other way round anymore
tron
parents: 3977
diff changeset
   281
3523
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   282
typedef enum RailGroundType {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   283
	RAIL_GROUND_BARREN       =  0,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   284
	RAIL_GROUND_GRASS        =  1,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   285
	RAIL_GROUND_FENCE_NW     =  2,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   286
	RAIL_GROUND_FENCE_SE     =  3,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   287
	RAIL_GROUND_FENCE_SENW   =  4,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   288
	RAIL_GROUND_FENCE_NE     =  5,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   289
	RAIL_GROUND_FENCE_SW     =  6,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   290
	RAIL_GROUND_FENCE_NESW   =  7,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   291
	RAIL_GROUND_FENCE_VERT1  =  8,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   292
	RAIL_GROUND_FENCE_VERT2  =  9,
3523
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   293
	RAIL_GROUND_FENCE_HORIZ1 = 10,
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   294
	RAIL_GROUND_FENCE_HORIZ2 = 11,
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4182
diff changeset
   295
	RAIL_GROUND_ICE_DESERT   = 12,
3523
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   296
} RailGroundType;
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   297
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   298
static inline void SetRailGroundType(TileIndex t, RailGroundType rgt)
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   299
{
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
   300
	if (GetRailTileType(t) == RAIL_TILE_DEPOT_WAYPOINT) {
3523
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   301
		SB(_m[t].m4, 0, 4, rgt);
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   302
		return;
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   303
	}
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   304
	SB(_m[t].m2, 0, 4, rgt);
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   305
}
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   306
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   307
static inline RailGroundType GetRailGroundType(TileIndex t)
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   308
{
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   309
	/* TODO Unify this */
3900
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3792
diff changeset
   310
	if (GetRailTileType(t) == RAIL_TILE_DEPOT_WAYPOINT) return (RailGroundType)GB(_m[t].m4, 0, 4);
4984308f9125 (svn r4987) Feature: Merged YAPF into trunk. Thanks to devs for continuous support and users for testing.
KUDr
parents: 3792
diff changeset
   311
	return (RailGroundType)GB(_m[t].m2, 0, 4);
3523
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   312
}
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   313
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   314
static inline bool IsSnowRailGround(TileIndex t)
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   315
{
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   316
	return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT;
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   317
}
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   318
168ee460418b (svn r4379) -Codechange: Add and make use of map accessor functions concerning rail ground types
celestar
parents: 3522
diff changeset
   319
3101
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   320
static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r)
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   321
{
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   322
	SetTileType(t, MP_RAILWAY);
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   323
	SetTileOwner(t, o);
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   324
	_m[t].m2 = 0;
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   325
	_m[t].m3 = r;
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   326
	_m[t].m4 = 0;
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
   327
	_m[t].m5 = RAIL_TILE_NORMAL | b;
3101
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   328
}
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   329
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   330
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   331
static inline void MakeRailDepot(TileIndex t, Owner o, DiagDirection d, RailType r)
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   332
{
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   333
	SetTileType(t, MP_RAILWAY);
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   334
	SetTileOwner(t, o);
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   335
	_m[t].m2 = 0;
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   336
	_m[t].m3 = r;
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   337
	_m[t].m4 = 0;
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
   338
	_m[t].m5 = RAIL_TILE_DEPOT_WAYPOINT | RAIL_SUBTYPE_DEPOT | d;
3101
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   339
}
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   340
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   341
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   342
static inline void MakeRailWaypoint(TileIndex t, Owner o, Axis a, RailType r, uint index)
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   343
{
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   344
	SetTileType(t, MP_RAILWAY);
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   345
	SetTileOwner(t, o);
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   346
	_m[t].m2 = index;
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   347
	_m[t].m3 = r;
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   348
	_m[t].m4 = 0;
3792
2eb8388731bf (svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
rubidium
parents: 3772
diff changeset
   349
	_m[t].m5 = RAIL_TILE_DEPOT_WAYPOINT | RAIL_SUBTYPE_WAYPOINT | a;
3101
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   350
}
e2fdb8802c2f (svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff changeset
   351
4666
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4474
diff changeset
   352
#endif /* RAIL_MAP_H */