author | KUDr |
Fri, 20 Apr 2007 19:43:06 +0000 | |
changeset 6513 | 454347ca3dfb |
parent 6422 | 6679df1c05ba |
child 6540 | d30795308feb |
permissions | -rw-r--r-- |
3154 | 1 |
/* $Id$ */ |
2 |
||
6422
6679df1c05ba
(svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas
parents:
5475
diff
changeset
|
3 |
/** @file tunnel_map.h */ |
6679df1c05ba
(svn r9558) -Documentation: doxygen and comment changes: 'T' now. Almost done
belugas
parents:
5475
diff
changeset
|
4 |
|
3154 | 5 |
#ifndef TUNNEL_MAP_H |
6 |
#define TUNNEL_MAP_H |
|
7 |
||
8 |
#include "direction.h" |
|
9 |
#include "macros.h" |
|
10 |
#include "map.h" |
|
11 |
#include "rail.h" |
|
12 |
||
13 |
||
3184
118a520164e4
(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 |
static inline bool IsTunnel(TileIndex t) |
118a520164e4
(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 |
{ |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3184
diff
changeset
|
16 |
assert(IsTileType(t, MP_TUNNELBRIDGE)); |
3184
118a520164e4
(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 |
return !HASBIT(_m[t].m5, 7); |
118a520164e4
(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 |
} |
118a520164e4
(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 |
|
118a520164e4
(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 |
|
118a520164e4
(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 IsTunnelTile(TileIndex t) |
118a520164e4
(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 |
{ |
118a520164e4
(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 |
return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t); |
118a520164e4
(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 |
} |
118a520164e4
(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 |
|
118a520164e4
(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 |
|
3154 | 27 |
static inline DiagDirection GetTunnelDirection(TileIndex t) |
28 |
{ |
|
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3184
diff
changeset
|
29 |
assert(IsTunnelTile(t)); |
3154 | 30 |
return (DiagDirection)GB(_m[t].m5, 0, 2); |
31 |
} |
|
32 |
||
33 |
||
34 |
static inline TransportType GetTunnelTransportType(TileIndex t) |
|
35 |
{ |
|
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3184
diff
changeset
|
36 |
assert(IsTunnelTile(t)); |
3154 | 37 |
return (TransportType)GB(_m[t].m5, 2, 2); |
38 |
} |
|
39 |
||
5410
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
40 |
static inline bool HasTunnelSnowOrDesert(TileIndex t) |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
41 |
{ |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
42 |
assert(IsTunnelTile(t)); |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
43 |
return HASBIT(_m[t].m4, 7); |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
44 |
} |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
45 |
|
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
46 |
static inline void SetTunnelSnowOrDesert(TileIndex t, bool snow_or_desert) |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
47 |
{ |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
48 |
assert(IsTunnelTile(t)); |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
49 |
SB(_m[t].m4, 7, 1, snow_or_desert); |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
50 |
} |
2dae82c6ea63
(svn r7607) -Codechange: remove direct map accesses for snow/desert on tunnels and bridges.
rubidium
parents:
4666
diff
changeset
|
51 |
|
3154 | 52 |
|
53 |
TileIndex GetOtherTunnelEnd(TileIndex); |
|
3156
f4caf4197189
(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
|
54 |
bool IsTunnelInWay(TileIndex, uint z); |
3154 | 55 |
|
56 |
||
57 |
static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d) |
|
58 |
{ |
|
59 |
SetTileType(t, MP_TUNNELBRIDGE); |
|
60 |
SetTileOwner(t, o); |
|
61 |
_m[t].m2 = 0; |
|
62 |
_m[t].m3 = 0; |
|
63 |
_m[t].m4 = 0; |
|
64 |
_m[t].m5 = TRANSPORT_ROAD << 2 | d; |
|
65 |
} |
|
66 |
||
67 |
static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r) |
|
68 |
{ |
|
69 |
SetTileType(t, MP_TUNNELBRIDGE); |
|
70 |
SetTileOwner(t, o); |
|
71 |
_m[t].m2 = 0; |
|
72 |
_m[t].m3 = r; |
|
73 |
_m[t].m4 = 0; |
|
74 |
_m[t].m5 = TRANSPORT_RAIL << 2 | d; |
|
75 |
} |
|
76 |
||
4666
172a0cdf28a6
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
3369
diff
changeset
|
77 |
#endif /* TUNNEL_MAP_H */ |