src/road_map.cpp
changeset 8083 ad22eade501f
parent 7928 63e18de69e50
child 8088 92fca5b09665
equal deleted inserted replaced
8082:63240e1bd6cc 8083:ad22eade501f
    10 #include "road_map.h"
    10 #include "road_map.h"
    11 #include "station.h"
    11 #include "station.h"
    12 #include "tunnel_map.h"
    12 #include "tunnel_map.h"
    13 #include "station_map.h"
    13 #include "station_map.h"
    14 #include "depot.h"
    14 #include "depot.h"
       
    15 #include "tunnelbridge_map.h"
    15 
    16 
    16 
    17 
    17 RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt)
    18 RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt)
    18 {
    19 {
    19 	if (!HasBit(GetRoadTypes(tile), rt)) return ROAD_NONE;
    20 	if (!HasBit(GetRoadTypes(tile), rt)) return ROAD_NONE;
    32 			if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y;
    33 			if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y;
    33 			return DiagDirToRoadBits(GetRoadStopDir(tile));
    34 			return DiagDirToRoadBits(GetRoadStopDir(tile));
    34 
    35 
    35 		case MP_TUNNELBRIDGE:
    36 		case MP_TUNNELBRIDGE:
    36 			if (IsTunnel(tile)) {
    37 			if (IsTunnel(tile)) {
    37 				if (GetTunnelTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
    38 				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
    38 				return DiagDirToRoadBits(ReverseDiagDir(GetTunnelDirection(tile)));
    39 				return DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
    39 			} else {
    40 			} else {
    40 				if (GetBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
    41 				if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
    41 				return DiagDirToRoadBits(ReverseDiagDir(GetBridgeRampDirection(tile)));
    42 				return DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
    42 			}
    43 			}
    43 
    44 
    44 		default: return ROAD_NONE;
    45 		default: return ROAD_NONE;
    45 	}
    46 	}
    46 }
    47 }