src/road_map.cpp
changeset 9212 3503ffa351b6
parent 9112 ec6800eaa340
child 9281 d8cd9ac52a68
equal deleted inserted replaced
9211:6ee04ee57ab5 9212:3503ffa351b6
    12 #include "station_map.h"
    12 #include "station_map.h"
    13 #include "depot.h"
    13 #include "depot.h"
    14 #include "tunnelbridge_map.h"
    14 #include "tunnelbridge_map.h"
    15 
    15 
    16 
    16 
    17 RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt)
    17 RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance)
    18 {
    18 {
    19 	if (!HasTileRoadType(tile, rt)) return ROAD_NONE;
    19 	if (!HasTileRoadType(tile, rt)) return ROAD_NONE;
    20 
    20 
    21 	switch (GetTileType(tile)) {
    21 	switch (GetTileType(tile)) {
    22 		case MP_ROAD:
    22 		case MP_ROAD:
    32 			if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y;
    32 			if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y;
    33 			return DiagDirToRoadBits(GetRoadStopDir(tile));
    33 			return DiagDirToRoadBits(GetRoadStopDir(tile));
    34 
    34 
    35 		case MP_TUNNELBRIDGE:
    35 		case MP_TUNNELBRIDGE:
    36 			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
    36 			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
    37 			return DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
    37 			return straight_tunnel_bridge_entrance ?
       
    38 					AxisToRoadBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) :
       
    39 					DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
    38 
    40 
    39 		default: return ROAD_NONE;
    41 		default: return ROAD_NONE;
    40 	}
    42 	}
    41 }
    43 }
    42 
    44