author | celestar |
Thu, 28 Dec 2006 17:30:06 +0000 | |
branch | custombridgeheads |
changeset 5591 | 8cd83b10634f |
parent 5590 | dc34c43fc3eb |
child 5592 | fd60d4ecc921 |
permissions | -rw-r--r-- |
3154 | 1 |
/* $Id$ */ |
2 |
||
3 |
#ifndef TUNNEL_MAP_H |
|
4 |
#define TUNNEL_MAP_H |
|
5 |
||
6 |
#include "direction.h" |
|
7 |
#include "macros.h" |
|
8 |
#include "map.h" |
|
9 |
#include "rail.h" |
|
10 |
||
5591
8cd83b10634f
(svn r7598) [cbh] - Codechange: Remove the functions IsTunnel() and IsBridge() as they are no longer needed.
celestar
parents:
5590
diff
changeset
|
11 |
static inline bool IsTunnelTile(TileIndex t) |
3184
7405329343ce
(svn r3830) Move IsTunnelTile() from tile.h to tunnel_map.h and add IsTunnel(), which just checks for a tunnel, but not the tile type as IsTunnelTile() does
tron
parents:
3156
diff
changeset
|
12 |
{ |
5590
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
4666
diff
changeset
|
13 |
return IsTileType(t, MP_TUNNEL); |
3184
7405329343ce
(svn r3830) Move IsTunnelTile() from tile.h to tunnel_map.h and add IsTunnel(), which just checks for a tunnel, but not the tile type as IsTunnelTile() does
tron
parents:
3156
diff
changeset
|
14 |
} |
7405329343ce
(svn r3830) Move IsTunnelTile() from tile.h to tunnel_map.h and add IsTunnel(), which just checks for a tunnel, but not the tile type as IsTunnelTile() does
tron
parents:
3156
diff
changeset
|
15 |
|
3154 | 16 |
static inline DiagDirection GetTunnelDirection(TileIndex t) |
17 |
{ |
|
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3184
diff
changeset
|
18 |
assert(IsTunnelTile(t)); |
3154 | 19 |
return (DiagDirection)GB(_m[t].m5, 0, 2); |
20 |
} |
|
21 |
||
22 |
||
23 |
static inline TransportType GetTunnelTransportType(TileIndex t) |
|
24 |
{ |
|
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3184
diff
changeset
|
25 |
assert(IsTunnelTile(t)); |
3154 | 26 |
return (TransportType)GB(_m[t].m5, 2, 2); |
27 |
} |
|
28 |
||
29 |
||
30 |
TileIndex GetOtherTunnelEnd(TileIndex); |
|
3156
028b6756b279
(svn r3779) Move CheckTunnelInWay() to a more appropriate place, invert its result and give it a less ambiguous name (IsTunnelInWay)
tron
parents:
3154
diff
changeset
|
31 |
bool IsTunnelInWay(TileIndex, uint z); |
3154 | 32 |
|
33 |
||
34 |
static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d) |
|
35 |
{ |
|
5590
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
4666
diff
changeset
|
36 |
SetTileType(t, MP_TUNNEL); |
3154 | 37 |
SetTileOwner(t, o); |
38 |
_m[t].m2 = 0; |
|
39 |
_m[t].m3 = 0; |
|
40 |
_m[t].m4 = 0; |
|
41 |
_m[t].m5 = TRANSPORT_ROAD << 2 | d; |
|
42 |
} |
|
43 |
||
44 |
static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r) |
|
45 |
{ |
|
5590
dc34c43fc3eb
(svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents:
4666
diff
changeset
|
46 |
SetTileType(t, MP_TUNNEL); |
3154 | 47 |
SetTileOwner(t, o); |
48 |
_m[t].m2 = 0; |
|
49 |
_m[t].m3 = r; |
|
50 |
_m[t].m4 = 0; |
|
51 |
_m[t].m5 = TRANSPORT_RAIL << 2 | d; |
|
52 |
} |
|
53 |
||
4666
850b5b6e4bac
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
3369
diff
changeset
|
54 |
#endif /* TUNNEL_MAP_H */ |