00001 /* $Id$ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. 00006 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00007 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. 00008 */ 00009 00012 #include "stdafx.h" 00013 #include "station_map.h" 00014 #include "tunnelbridge_map.h" 00015 00016 00033 RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance) 00034 { 00035 if (!HasTileRoadType(tile, rt)) return ROAD_NONE; 00036 00037 switch (GetTileType(tile)) { 00038 case MP_ROAD: 00039 switch (GetRoadTileType(tile)) { 00040 default: 00041 case ROAD_TILE_NORMAL: return GetRoadBits(tile, rt); 00042 case ROAD_TILE_CROSSING: return GetCrossingRoadBits(tile); 00043 case ROAD_TILE_DEPOT: return DiagDirToRoadBits(GetRoadDepotDirection(tile)); 00044 } 00045 00046 case MP_STATION: 00047 if (!IsRoadStopTile(tile)) return ROAD_NONE; 00048 if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y; 00049 return DiagDirToRoadBits(GetRoadStopDir(tile)); 00050 00051 case MP_TUNNELBRIDGE: 00052 if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE; 00053 return straight_tunnel_bridge_entrance ? 00054 AxisToRoadBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) : 00055 DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile))); 00056 00057 default: return ROAD_NONE; 00058 } 00059 }