# road_map.cpp

Go to the documentation of this file.

    00001 /* $Id: road_map.cpp 16804 2009-07-13 10:16:50Z rubidium $ */
    00002
    00005 #include "stdafx.h"
    00006 #include "station_map.h"
    00007 #include "tunnelbridge_map.h"
    00008
    00009
    00010 RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance)
    00011 {
    00012   if (!HasTileRoadType(tile, rt)) return ROAD_NONE;
    00013
    00014   switch (GetTileType(tile)) {
    00015     case MP_ROAD:
    00016       switch (GetRoadTileType(tile)) {
    00017         default:
    00018         case ROAD_TILE_NORMAL:   return GetRoadBits(tile, rt);
    00019         case ROAD_TILE_CROSSING: return GetCrossingRoadBits(tile);
    00020         case ROAD_TILE_DEPOT:    return DiagDirToRoadBits(GetRoadDepotDirection(tile));
    00021       }
    00022
    00023     case MP_STATION:
    00024       if (!IsRoadStopTile(tile)) return ROAD_NONE;
    00025       if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y;
    00026       return DiagDirToRoadBits(GetRoadStopDir(tile));
    00027
    00028     case MP_TUNNELBRIDGE:
    00029       if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
    00030       return straight_tunnel_bridge_entrance ?
    00031           AxisToRoadBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) :
    00032           DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
    00033
    00034     default: return ROAD_NONE;
    00035   }
    00036 }