src/road_map.cpp
branchNewGRF_ports
changeset 10184 fcf5fb2548eb
parent 6878 7d1ff2f621c7
child 10242 52b4a9006029
equal deleted inserted replaced
10179:eec5a7dcbf61 10184:fcf5fb2548eb
     5 #include "stdafx.h"
     5 #include "stdafx.h"
     6 #include "openttd.h"
     6 #include "openttd.h"
     7 #include "bridge_map.h"
     7 #include "bridge_map.h"
     8 #include "tile_cmd.h"
     8 #include "tile_cmd.h"
     9 #include "road_map.h"
     9 #include "road_map.h"
    10 #include "station.h"
       
    11 #include "tunnel_map.h"
    10 #include "tunnel_map.h"
    12 #include "station_map.h"
    11 #include "station_map.h"
    13 #include "depot.h"
    12 #include "depot.h"
    14 #include "tunnelbridge_map.h"
    13 #include "tunnelbridge_map.h"
    15 
    14 
    16 
    15 
    17 RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt)
    16 RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance)
    18 {
    17 {
    19 	if (!HasTileRoadType(tile, rt)) return ROAD_NONE;
    18 	if (!HasTileRoadType(tile, rt)) return ROAD_NONE;
    20 
    19 
    21 	switch (GetTileType(tile)) {
    20 	switch (GetTileType(tile)) {
    22 		case MP_ROAD:
    21 		case MP_ROAD:
    32 			if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y;
    31 			if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y;
    33 			return DiagDirToRoadBits(GetRoadStopDir(tile));
    32 			return DiagDirToRoadBits(GetRoadStopDir(tile));
    34 
    33 
    35 		case MP_TUNNELBRIDGE:
    34 		case MP_TUNNELBRIDGE:
    36 			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
    35 			if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
    37 			return DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
    36 			return straight_tunnel_bridge_entrance ?
       
    37 					AxisToRoadBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) :
       
    38 					DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
    38 
    39 
    39 		default: return ROAD_NONE;
    40 		default: return ROAD_NONE;
    40 	}
    41 	}
    41 }
    42 }
    42 
    43