author | celestar |
Fri, 29 Dec 2006 12:45:44 +0000 | |
branch | custombridgeheads |
changeset 5597 | ffc0b228cee6 |
parent 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 |
||
5592
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
29 |
static inline bool HasTunnelSnowOrDesert(TileIndex t) |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
30 |
{ |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
31 |
assert(IsTunnelTile(t)); |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
32 |
return HASBIT(_m[t].m4, 7); |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
33 |
} |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
34 |
|
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
35 |
static inline void SetTunnelSnowOrDesert(TileIndex t, bool snow_or_desert) |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
36 |
{ |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
37 |
assert(IsTunnelTile(t)); |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
38 |
SB(_m[t].m4, 7, 1, snow_or_desert); |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
39 |
} |
fd60d4ecc921
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents:
5591
diff
changeset
|
40 |
|
3154 | 41 |
|
42 |
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
|
43 |
bool IsTunnelInWay(TileIndex, uint z); |
3154 | 44 |
|
45 |
||
46 |
static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d) |
|
47 |
{ |
|
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
|
48 |
SetTileType(t, MP_TUNNEL); |
3154 | 49 |
SetTileOwner(t, o); |
50 |
_m[t].m2 = 0; |
|
51 |
_m[t].m3 = 0; |
|
52 |
_m[t].m4 = 0; |
|
53 |
_m[t].m5 = TRANSPORT_ROAD << 2 | d; |
|
54 |
} |
|
55 |
||
56 |
static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r) |
|
57 |
{ |
|
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
|
58 |
SetTileType(t, MP_TUNNEL); |
3154 | 59 |
SetTileOwner(t, o); |
60 |
_m[t].m2 = 0; |
|
61 |
_m[t].m3 = r; |
|
62 |
_m[t].m4 = 0; |
|
63 |
_m[t].m5 = TRANSPORT_RAIL << 2 | d; |
|
64 |
} |
|
65 |
||
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
|
66 |
#endif /* TUNNEL_MAP_H */ |