author | richk |
Tue, 17 Jun 2008 10:32:49 +0000 | |
branch | NewGRF_ports |
changeset 10991 | d8811e327d12 |
parent 10724 | 68a692eacf22 |
permissions | -rw-r--r-- |
3154 | 1 |
/* $Id$ */ |
2 |
||
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
6872
diff
changeset
|
3 |
/** @file tunnel_map.h Map accessors for tunnels. */ |
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
4 |
|
3154 | 5 |
#ifndef TUNNEL_MAP_H |
6 |
#define TUNNEL_MAP_H |
|
7 |
||
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
8 |
#include "direction_func.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
9 |
#include "rail_type.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
10 |
#include "road_type.h" |
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
6872
diff
changeset
|
11 |
#include "transport_type.h" |
6872
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
12 |
#include "tile_map.h" |
1c4a4a609f85
(svn r11950) [NewGRF_ports] -Sync with trunk r11566:11949.
rubidium
parents:
6871
diff
changeset
|
13 |
|
3154 | 14 |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
15 |
/** |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
16 |
* Is this a tunnel (entrance)? |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
17 |
* @param t the tile that might be a tunnel |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
18 |
* @pre IsTileType(t, MP_TUNNELBRIDGE) |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
19 |
* @return true if and only if this tile is a tunnel (entrance) |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
20 |
*/ |
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
|
21 |
static inline bool IsTunnel(TileIndex t) |
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
|
22 |
{ |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3184
diff
changeset
|
23 |
assert(IsTileType(t, MP_TUNNELBRIDGE)); |
6871
5a9dc001e1ad
(svn r11566) [NewGRF_ports] -Sync: with trunk r11218:r11565.
rubidium
parents:
6720
diff
changeset
|
24 |
return !HasBit(_m[t].m5, 7); |
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
|
25 |
} |
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
|
26 |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
27 |
/** |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
28 |
* Is this a tunnel (entrance)? |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
29 |
* @param t the tile that might be a tunnel |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
30 |
* @return true if and only if this tile is a tunnel (entrance) |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
31 |
*/ |
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
|
32 |
static inline bool IsTunnelTile(TileIndex t) |
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
|
33 |
{ |
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
|
34 |
return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t); |
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
|
35 |
} |
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
|
36 |
|
3154 | 37 |
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
|
38 |
bool IsTunnelInWay(TileIndex, uint z); |
6720
35756db7e577
(svn r10560) [NewGRF_ports] -Sync: with trunk r10027-10559
richk
parents:
6719
diff
changeset
|
39 |
bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir); |
3154 | 40 |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
41 |
/** |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
42 |
* Makes a road tunnel entrance |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
43 |
* @param t the entrance of the tunnel |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
44 |
* @param o the owner of the entrance |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
45 |
* @param d the direction facing out of the tunnel |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
46 |
* @param r the road type used in the tunnel |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
47 |
*/ |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
48 |
static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d, RoadTypes r) |
3154 | 49 |
{ |
50 |
SetTileType(t, MP_TUNNELBRIDGE); |
|
51 |
SetTileOwner(t, o); |
|
52 |
_m[t].m2 = 0; |
|
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
53 |
_m[t].m3 = r; |
3154 | 54 |
_m[t].m4 = 0; |
55 |
_m[t].m5 = TRANSPORT_ROAD << 2 | d; |
|
56 |
} |
|
57 |
||
6719
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
58 |
/** |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
59 |
* Makes a rail tunnel entrance |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
60 |
* @param t the entrance of the tunnel |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
61 |
* @param o the owner of the entrance |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
62 |
* @param d the direction facing out of the tunnel |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
63 |
* @param r the rail type used in the tunnel |
4cc327ad39d5
(svn r10027) [NewGRF_ports] -Sync: with trunk r9506-10026
richk
parents:
5726
diff
changeset
|
64 |
*/ |
3154 | 65 |
static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r) |
66 |
{ |
|
67 |
SetTileType(t, MP_TUNNELBRIDGE); |
|
68 |
SetTileOwner(t, o); |
|
69 |
_m[t].m2 = 0; |
|
70 |
_m[t].m3 = r; |
|
71 |
_m[t].m4 = 0; |
|
72 |
_m[t].m5 = TRANSPORT_RAIL << 2 | d; |
|
73 |
} |
|
74 |
||
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
|
75 |
#endif /* TUNNEL_MAP_H */ |