author | truebrain |
Fri, 13 Jun 2008 19:57:25 +0000 | |
branch | noai |
changeset 10957 | 7a140b4cd91d |
parent 10455 | 22c441f5adf9 |
permissions | -rw-r--r-- |
3154 | 1 |
/* $Id$ */ |
2 |
||
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
9723
diff
changeset
|
3 |
/** @file tunnel_map.h Map accessors for tunnels. */ |
9574 | 4 |
|
3154 | 5 |
#ifndef TUNNEL_MAP_H |
6 |
#define TUNNEL_MAP_H |
|
7 |
||
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
8 |
#include "direction_func.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
9 |
#include "rail_type.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
10 |
#include "road_type.h" |
10455
22c441f5adf9
(svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents:
9723
diff
changeset
|
11 |
#include "transport_type.h" |
9723
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
12 |
#include "tile_map.h" |
eee46cb39750
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
rubidium
parents:
9722
diff
changeset
|
13 |
|
3154 | 14 |
|
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
15 |
/** |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
16 |
* Is this a tunnel (entrance)? |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
17 |
* @param t the tile that might be a tunnel |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
18 |
* @pre IsTileType(t, MP_TUNNELBRIDGE) |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
19 |
* @return true if and only if this tile is a tunnel (entrance) |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
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)); |
9722
ebf0ece7d8f6
(svn r11503) [NoAI] -Sync: with trunk r11308:11502.
rubidium
parents:
9629
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 |
|
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
27 |
/** |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
28 |
* Is this a tunnel (entrance)? |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
29 |
* @param t the tile that might be a tunnel |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
30 |
* @return true if and only if this tile is a tunnel (entrance) |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
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); |
9629 | 39 |
bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir); |
3154 | 40 |
|
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
41 |
/** |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
42 |
* Makes a road tunnel entrance |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
43 |
* @param t the entrance of the tunnel |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
44 |
* @param o the owner of the entrance |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
45 |
* @param d the direction facing out of the tunnel |
9624 | 46 |
* @param r the road type used in the tunnel |
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
47 |
*/ |
9624 | 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; |
|
9624 | 53 |
_m[t].m3 = r; |
3154 | 54 |
_m[t].m4 = 0; |
55 |
_m[t].m5 = TRANSPORT_ROAD << 2 | d; |
|
56 |
} |
|
57 |
||
9620
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
58 |
/** |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
59 |
* Makes a rail tunnel entrance |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
60 |
* @param t the entrance of the tunnel |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
61 |
* @param o the owner of the entrance |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
62 |
* @param d the direction facing out of the tunnel |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
diff
changeset
|
63 |
* @param r the rail type used in the tunnel |
31e38d28a0af
(svn r9816) [NoAI] -Sync with trunk r9712:9815 except r9759 (MorphOS threading) because that needs special attention.
rubidium
parents:
9574
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 */ |