Files
@ r8784:f3d6ba8eb078
Branch filter:
Location: cpp/openttd-patchpack/source/src/road_map.cpp - annotation
r8784:f3d6ba8eb078
1.6 KiB
text/x-c
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
r5584:545d748cc681 r5584:545d748cc681 r6393:f9322fdf4c2c r6393:f9322fdf4c2c r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8119:8fdb3a371896 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8083:8cd2123a0c7c r5584:545d748cc681 r5584:545d748cc681 r8716:fe14dd1f6c9e r5584:545d748cc681 r8563:f734b85d629c r6661:a60bd28b4b57 r5584:545d748cc681 r7370:ef5901b27aca r5584:545d748cc681 r5584:545d748cc681 r6661:a60bd28b4b57 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5587:034e5e185dc2 r6012:6160fb57dc8a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8088:0596dcb18b35 r8716:fe14dd1f6c9e r8716:fe14dd1f6c9e r8716:fe14dd1f6c9e r5584:545d748cc681 r5587:034e5e185dc2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6661:a60bd28b4b57 r5584:545d748cc681 r6418:8a4b147a8f33 r8563:f734b85d629c r5587:034e5e185dc2 r5584:545d748cc681 r5584:545d748cc681 r8616:656db5986c9e r5584:545d748cc681 | /* $Id$ */
/** @file road_map.cpp */
#include "stdafx.h"
#include "openttd.h"
#include "bridge_map.h"
#include "tile_cmd.h"
#include "road_map.h"
#include "station.h"
#include "tunnel_map.h"
#include "station_map.h"
#include "depot.h"
#include "tunnelbridge_map.h"
RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance)
{
if (!HasTileRoadType(tile, rt)) return ROAD_NONE;
switch (GetTileType(tile)) {
case MP_ROAD:
switch (GetRoadTileType(tile)) {
default:
case ROAD_TILE_NORMAL: return GetRoadBits(tile, rt);
case ROAD_TILE_CROSSING: return GetCrossingRoadBits(tile);
case ROAD_TILE_DEPOT: return DiagDirToRoadBits(GetRoadDepotDirection(tile));
}
case MP_STATION:
if (!IsRoadStopTile(tile)) return ROAD_NONE;
if (IsDriveThroughStopTile(tile)) return (GetRoadStopDir(tile) == DIAGDIR_NE) ? ROAD_X : ROAD_Y;
return DiagDirToRoadBits(GetRoadStopDir(tile));
case MP_TUNNELBRIDGE:
if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return ROAD_NONE;
return straight_tunnel_bridge_entrance ?
AxisToRoadBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) :
DiagDirToRoadBits(ReverseDiagDir(GetTunnelBridgeDirection(tile)));
default: return ROAD_NONE;
}
}
TrackBits GetAnyRoadTrackBits(TileIndex tile, RoadType rt)
{
/* Don't allow local authorities to build roads through road depots or road stops. */
if (IsRoadDepotTile(tile) || (IsTileType(tile, MP_STATION) && !IsDriveThroughStopTile(tile)) || !HasTileRoadType(tile, rt)) {
return TRACK_BIT_NONE;
}
return TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, RoadTypeToRoadTypes(rt)));
}
|