OpenTTD
tunnelbridge_map.h
Go to the documentation of this file.
1 /* $Id: tunnelbridge_map.h 24900 2013-01-08 22:46:42Z planetmaker $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef TUNNELBRIDGE_MAP_H
13 #define TUNNELBRIDGE_MAP_H
14 
15 #include "bridge_map.h"
16 #include "tunnel_map.h"
17 
18 
29 {
30  assert(IsTileType(t, MP_TUNNELBRIDGE));
31  return (DiagDirection)GB(_m[t].m5, 0, 2);
32 }
33 
42 {
43  assert(IsTileType(t, MP_TUNNELBRIDGE));
44  return (TransportType)GB(_m[t].m5, 2, 2);
45 }
46 
55 {
56  assert(IsTileType(t, MP_TUNNELBRIDGE));
57  return HasBit(_me[t].m7, 5);
58 }
59 
68 static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
69 {
70  assert(IsTileType(t, MP_TUNNELBRIDGE));
71  SB(_me[t].m7, 5, 1, snow_or_desert);
72 }
73 
81 {
82  assert(IsTileType(t, MP_TUNNELBRIDGE));
83  return IsTunnel(t) ? GetOtherTunnelEnd(t) : GetOtherBridgeEnd(t);
84 }
85 
86 
94 {
95  assert(IsTileType(t, MP_TUNNELBRIDGE));
97  return HasBit(_m[t].m5, 4);
98 }
99 
106 static inline void SetTunnelBridgeReservation(TileIndex t, bool b)
107 {
108  assert(IsTileType(t, MP_TUNNELBRIDGE));
110  SB(_m[t].m5, 4, 1, b ? 1 : 0);
111 }
112 
120 {
122 }
123 
124 #endif /* TUNNELBRIDGE_MAP_H */