author | miham |
Tue, 12 Dec 2006 18:19:33 +0000 | |
changeset 5327 | ea7fb3e7d54c |
parent 4666 | 850b5b6e4bac |
child 5513 | 0d3227e250eb |
child 5590 | dc34c43fc3eb |
child 5661 | 6c6145677e7c |
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 |
{ |
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3184
diff
changeset
|
14 |
assert(IsTileType(t, MP_TUNNELBRIDGE)); |
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
|
15 |
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
|
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 |
|
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 |
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
|
20 |
{ |
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 |
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
|
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 |
|
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
|
24 |
|
3154 | 25 |
static inline DiagDirection GetTunnelDirection(TileIndex t) |
26 |
{ |
|
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3184
diff
changeset
|
27 |
assert(IsTunnelTile(t)); |
3154 | 28 |
return (DiagDirection)GB(_m[t].m5, 0, 2); |
29 |
} |
|
30 |
||
31 |
||
32 |
static inline TransportType GetTunnelTransportType(TileIndex t) |
|
33 |
{ |
|
3369
00c2ca209a89
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3184
diff
changeset
|
34 |
assert(IsTunnelTile(t)); |
3154 | 35 |
return (TransportType)GB(_m[t].m5, 2, 2); |
36 |
} |
|
37 |
||
38 |
||
39 |
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
|
40 |
bool IsTunnelInWay(TileIndex, uint z); |
3154 | 41 |
|
42 |
||
43 |
static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d) |
|
44 |
{ |
|
45 |
SetTileType(t, MP_TUNNELBRIDGE); |
|
46 |
SetTileOwner(t, o); |
|
47 |
_m[t].m2 = 0; |
|
48 |
_m[t].m3 = 0; |
|
49 |
_m[t].m4 = 0; |
|
50 |
_m[t].m5 = TRANSPORT_ROAD << 2 | d; |
|
51 |
} |
|
52 |
||
53 |
static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r) |
|
54 |
{ |
|
55 |
SetTileType(t, MP_TUNNELBRIDGE); |
|
56 |
SetTileOwner(t, o); |
|
57 |
_m[t].m2 = 0; |
|
58 |
_m[t].m3 = r; |
|
59 |
_m[t].m4 = 0; |
|
60 |
_m[t].m5 = TRANSPORT_RAIL << 2 | d; |
|
61 |
} |
|
62 |
||
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
|
63 |
#endif /* TUNNEL_MAP_H */ |