road_map.cpp File Reference

Complex road accessors. More...

#include "stdafx.h"
#include "station_map.h"
#include "tunnelbridge_map.h"

Go to the source code of this file.

Functions

RoadBits GetAnyRoadBits (TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance)
 Returns the RoadBits on an arbitrary tile Special behaviour:
  • road depots: entrance is treated as road piece
  • road tunnels: entrance is treated as road piece
  • bridge ramps: start of the ramp is treated as road piece
  • bridge middle parts: bridge itself is ignored.

TrackBits GetAnyRoadTrackBits (TileIndex tile, RoadType rt)
 Get the accessible track bits for the given tile.


Detailed Description

Complex road accessors.

Definition in file road_map.cpp.


Function Documentation

RoadBits GetAnyRoadBits ( TileIndex  tile,
RoadType  rt,
bool  straight_tunnel_bridge_entrance = false 
)

Returns the RoadBits on an arbitrary tile Special behaviour:

  • road depots: entrance is treated as road piece
  • road tunnels: entrance is treated as road piece
  • bridge ramps: start of the ramp is treated as road piece
  • bridge middle parts: bridge itself is ignored.

If straight_tunnel_bridge_entrance is set a ROAD_X or ROAD_Y for bridge ramps and tunnel entrances is returned depending on the orientation of the tunnel or bridge.

Parameters:
tile the tile to get the road bits for
rt the road type to get the road bits form
stbe whether to return straight road bits for tunnels/bridges.
Returns:
the road bits of the given tile

Definition at line 10 of file road_map.cpp.

References AxisToRoadBits(), DIAGDIR_NE, DiagDirToAxis(), DiagDirToRoadBits(), GetRoadStopDir(), GetTileType(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), MP_ROAD, MP_STATION, MP_TUNNELBRIDGE, ReverseDiagDir(), ROAD_NONE, ROAD_X, ROAD_Y, and TRANSPORT_ROAD.

Referenced by AIRoad::AreRoadTilesConnected(), AIRoad::CanBuildConnectedRoadPartsHere(), CanRemoveRoadWithStop(), CheckAllowRemoveRoad(), CleanUpRoadBits(), AIRoad::HasRoadType(), and RoadFindPathToDest().

TrackBits GetAnyRoadTrackBits ( TileIndex  tile,
RoadType  rt 
)

Get the accessible track bits for the given tile.

Special behaviour:

  • road depots: no track bits
  • non-drive-through stations: no track bits
    Parameters:
    tile the tile to get the track bits for
    Returns:
    the track bits for the given tile

Definition at line 39 of file road_map.cpp.

References GetTileTrackStatus(), IsTileType(), MP_STATION, RoadTypeToRoadTypes(), TRACK_BIT_NONE, TrackStatusToTrackBits(), and TRANSPORT_ROAD.

Referenced by GetTownRoadBits().


Generated on Mon Jun 8 23:04:14 2009 for OpenTTD by  doxygen 1.5.6