src/bridge_map.h
branchgamebalance
changeset 9911 0b8b245a2391
parent 9908 0fa543611bbe
child 9694 e72987579514
equal deleted inserted replaced
9910:0b2aebc8283e 9911:0b8b245a2391
   209 {
   209 {
   210 	assert(MayHaveBridgeAbove(t));
   210 	assert(MayHaveBridgeAbove(t));
   211 	SETBIT(_m[t].m6, 6 + a);
   211 	SETBIT(_m[t].m6, 6 + a);
   212 }
   212 }
   213 
   213 
   214 
       
   215 /**
   214 /**
   216  * Generic part to make a bridge ramp for both roads and rails.
   215  * Generic part to make a bridge ramp for both roads and rails.
   217  * @param t          the tile to make a bridge ramp
   216  * @param t          the tile to make a bridge ramp
   218  * @param o          the new owner of the bridge ramp
   217  * @param o          the new owner of the bridge ramp
   219  * @param bridgetype the type of bridge this bridge ramp belongs to
   218  * @param bridgetype the type of bridge this bridge ramp belongs to
   220  * @param d          the direction this ramp must be facing
   219  * @param d          the direction this ramp must be facing
   221  * @param tt         the transport type of the bridge
   220  * @param tt         the transport type of the bridge
       
   221  * @param rt         the road or rail type
   222  * @note this function should not be called directly.
   222  * @note this function should not be called directly.
   223  */
   223  */
   224 static inline void MakeBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, TransportType tt)
   224 static inline void MakeBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, TransportType tt, uint rt)
   225 {
   225 {
   226 	SetTileType(t, MP_TUNNELBRIDGE);
   226 	SetTileType(t, MP_TUNNELBRIDGE);
   227 	SetTileOwner(t, o);
   227 	SetTileOwner(t, o);
   228 	_m[t].m2 = bridgetype << 4;
   228 	_m[t].m2 = bridgetype << 4;
       
   229 	_m[t].m3 = rt;
   229 	_m[t].m4 = 0;
   230 	_m[t].m4 = 0;
   230 	_m[t].m5 = 1 << 7 | tt << 2 | d;
   231 	_m[t].m5 = 1 << 7 | tt << 2 | d;
   231 }
   232 }
   232 
   233 
   233 /**
   234 /**
   234  * Make a bridge ramp for roads.
   235  * Make a bridge ramp for roads.
   235  * @param t          the tile to make a bridge ramp
   236  * @param t          the tile to make a bridge ramp
   236  * @param o          the new owner of the bridge ramp
   237  * @param o          the new owner of the bridge ramp
   237  * @param bridgetype the type of bridge this bridge ramp belongs to
   238  * @param bridgetype the type of bridge this bridge ramp belongs to
   238  * @param d          the direction this ramp must be facing
   239  * @param d          the direction this ramp must be facing
   239  */
   240  * @param r          the road type of the bridge
   240 static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d)
   241  */
   241 {
   242 static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RoadTypes r)
   242 	MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD);
   243 {
   243 	_m[t].m3 = 0;
   244 	MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD, r);
   244 }
   245 }
   245 
   246 
   246 /**
   247 /**
   247  * Make a bridge ramp for rails.
   248  * Make a bridge ramp for rails.
   248  * @param t          the tile to make a bridge ramp
   249  * @param t          the tile to make a bridge ramp
   251  * @param d          the direction this ramp must be facing
   252  * @param d          the direction this ramp must be facing
   252  * @param r          the rail type of the bridge
   253  * @param r          the rail type of the bridge
   253  */
   254  */
   254 static inline void MakeRailBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RailType r)
   255 static inline void MakeRailBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RailType r)
   255 {
   256 {
   256 	MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL);
   257 	MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL, r);
   257 	_m[t].m3 = r;
       
   258 }
   258 }
   259 
   259 
   260 
   260 
   261 #endif /* BRIDGE_MAP_H */
   261 #endif /* BRIDGE_MAP_H */