author | truelight |
Thu, 23 Mar 2006 17:38:31 +0000 | |
changeset 3308 | 287d8e862ddf |
parent 3184 | 7405329343ce |
child 3369 | 00c2ca209a89 |
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 |
||
11 |
||
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 |
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
|
13 |
{ |
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 |
return !HASBIT(_m[t].m5, 7); |
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 |
} |
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
|
16 |
|
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
|
17 |
|
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
|
18 |
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
|
19 |
{ |
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
|
20 |
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
|
21 |
} |
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 |
|
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
|
23 |
|
3154 | 24 |
static inline DiagDirection GetTunnelDirection(TileIndex t) |
25 |
{ |
|
26 |
return (DiagDirection)GB(_m[t].m5, 0, 2); |
|
27 |
} |
|
28 |
||
29 |
||
30 |
static inline TransportType GetTunnelTransportType(TileIndex t) |
|
31 |
{ |
|
32 |
return (TransportType)GB(_m[t].m5, 2, 2); |
|
33 |
} |
|
34 |
||
35 |
||
36 |
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
|
37 |
bool IsTunnelInWay(TileIndex, uint z); |
3154 | 38 |
|
39 |
||
40 |
static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d) |
|
41 |
{ |
|
42 |
SetTileType(t, MP_TUNNELBRIDGE); |
|
43 |
SetTileOwner(t, o); |
|
44 |
_m[t].m2 = 0; |
|
45 |
_m[t].m3 = 0; |
|
46 |
_m[t].m4 = 0; |
|
47 |
_m[t].m5 = TRANSPORT_ROAD << 2 | d; |
|
48 |
} |
|
49 |
||
50 |
static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r) |
|
51 |
{ |
|
52 |
SetTileType(t, MP_TUNNELBRIDGE); |
|
53 |
SetTileOwner(t, o); |
|
54 |
_m[t].m2 = 0; |
|
55 |
_m[t].m3 = r; |
|
56 |
_m[t].m4 = 0; |
|
57 |
_m[t].m5 = TRANSPORT_RAIL << 2 | d; |
|
58 |
} |
|
59 |
||
60 |
#endif |