road_map.cpp

Go to the documentation of this file.
00001 /* $Id: road_map.cpp 17248 2009-08-21 20:21:05Z rubidium $ */
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 
00017 RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance)
00018 {
00019   if (!HasTileRoadType(tile, rt)) return ROAD_NONE;
00020 
00021   switch (GetTileType(tile)) {
00022     case MP_ROAD:
00023       switch (GetRoadTileType(tile)) {
00024         default:
00025         case ROAD_TILE_NORMAL:   return GetRoadBits(tile, rt);
00026         case ROAD_TILE_CROSSING: return GetCrossingRoadBits(tile);
00027         case ROAD_TILE_DEPOT:    return DiagDirToRoadBits(GetRoadDepotDirection(tile));
00028       }
00029 
00030     case MP_STATION:
00031       if (!IsRoadStopTile(tile)) return ROAD_NONE;
00032       if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y;
00033       return DiagDirToRoadBits(GetRoadStopDir(tile));
00034 
00035     case MP_TUNNELBRIDGE:
00036       if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
00037       return straight_tunnel_bridge_entrance ?
00038           AxisToRoadBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) :
00039           DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
00040 
00041     default: return ROAD_NONE;
00042   }
00043 }

Generated on Wed Mar 31 22:43:27 2010 for OpenTTD by  doxygen 1.6.1