equal
deleted
inserted
replaced
6 #define BRIDGE_MAP_H |
6 #define BRIDGE_MAP_H |
7 |
7 |
8 #include "direction_func.h" |
8 #include "direction_func.h" |
9 #include "rail_type.h" |
9 #include "rail_type.h" |
10 #include "road_map.h" |
10 #include "road_map.h" |
|
11 #include "bridge.h" |
11 |
12 |
12 |
13 |
13 /** |
14 /** |
14 * Checks if this is a bridge, instead of a tunnel |
15 * Checks if this is a bridge, instead of a tunnel |
15 * @param t The tile to analyze |
16 * @param t The tile to analyze |
65 * Determines the type of bridge on a tile |
66 * Determines the type of bridge on a tile |
66 * @param t The tile to analyze |
67 * @param t The tile to analyze |
67 * @pre IsBridgeTile(t) |
68 * @pre IsBridgeTile(t) |
68 * @return The bridge type |
69 * @return The bridge type |
69 */ |
70 */ |
70 static inline uint GetBridgeType(TileIndex t) |
71 static inline BridgeType GetBridgeType(TileIndex t) |
71 { |
72 { |
72 assert(IsBridgeTile(t)); |
73 assert(IsBridgeTile(t)); |
73 return GB(_m[t].m2, 4, 4); |
74 return GB(_m[t].m2, 4, 4); |
74 } |
75 } |
75 |
76 |
161 * @param d the direction this ramp must be facing |
162 * @param d the direction this ramp must be facing |
162 * @param tt the transport type of the bridge |
163 * @param tt the transport type of the bridge |
163 * @param rt the road or rail type |
164 * @param rt the road or rail type |
164 * @note this function should not be called directly. |
165 * @note this function should not be called directly. |
165 */ |
166 */ |
166 static inline void MakeBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, TransportType tt, uint rt) |
167 static inline void MakeBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, TransportType tt, uint rt) |
167 { |
168 { |
168 SetTileType(t, MP_TUNNELBRIDGE); |
169 SetTileType(t, MP_TUNNELBRIDGE); |
169 SetTileOwner(t, o); |
170 SetTileOwner(t, o); |
170 _m[t].m2 = bridgetype << 4; |
171 _m[t].m2 = bridgetype << 4; |
171 _m[t].m3 = rt; |
172 _m[t].m3 = rt; |
179 * @param o the new owner of the bridge ramp |
180 * @param o the new owner of the bridge ramp |
180 * @param bridgetype the type of bridge this bridge ramp belongs to |
181 * @param bridgetype the type of bridge this bridge ramp belongs to |
181 * @param d the direction this ramp must be facing |
182 * @param d the direction this ramp must be facing |
182 * @param r the road type of the bridge |
183 * @param r the road type of the bridge |
183 */ |
184 */ |
184 static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RoadTypes r) |
185 static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RoadTypes r) |
185 { |
186 { |
186 MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD, r); |
187 MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD, r); |
187 } |
188 } |
188 |
189 |
189 /** |
190 /** |
192 * @param o the new owner of the bridge ramp |
193 * @param o the new owner of the bridge ramp |
193 * @param bridgetype the type of bridge this bridge ramp belongs to |
194 * @param bridgetype the type of bridge this bridge ramp belongs to |
194 * @param d the direction this ramp must be facing |
195 * @param d the direction this ramp must be facing |
195 * @param r the rail type of the bridge |
196 * @param r the rail type of the bridge |
196 */ |
197 */ |
197 static inline void MakeRailBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RailType r) |
198 static inline void MakeRailBridgeRamp(TileIndex t, Owner o, BridgeType bridgetype, DiagDirection d, RailType r) |
198 { |
199 { |
199 MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL, r); |
200 MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL, r); |
200 } |
201 } |
201 |
202 |
202 |
203 |