road_map.h File Reference

#include "track_func.h"
#include "rail_type.h"
#include "town_type.h"
#include "road_func.h"
#include "tile_map.h"

Go to the source code of this file.

Defines

#define IsOnDesert   IsOnSnow
#define ToggleDesert   ToggleSnow

Enumerations

enum  RoadTileType { ROAD_TILE_NORMAL, ROAD_TILE_CROSSING, ROAD_TILE_DEPOT }
enum  DisallowedRoadDirections {
  DRD_NONE, DRD_SOUTHBOUND, DRD_NORTHBOUND, DRD_BOTH,
  DRD_END
}
 Which directions are disallowed ? More...
enum  Roadside {
  ROADSIDE_BARREN = 0, ROADSIDE_GRASS = 1, ROADSIDE_PAVED = 2, ROADSIDE_STREET_LIGHTS = 3,
  ROADSIDE_TREES = 5, ROADSIDE_GRASS_ROAD_WORKS = 6, ROADSIDE_PAVED_ROAD_WORKS = 7
}

Functions

static RoadTileType GetRoadTileType (TileIndex t)
static bool IsNormalRoad (TileIndex t)
static bool IsNormalRoadTile (TileIndex t)
static bool IsLevelCrossing (TileIndex t)
static bool IsLevelCrossingTile (TileIndex t)
static bool IsRoadDepot (TileIndex t)
static bool IsRoadDepotTile (TileIndex t)
static RoadBits GetRoadBits (TileIndex t, RoadType rt)
static RoadBits GetAllRoadBits (TileIndex tile)
static void SetRoadBits (TileIndex t, RoadBits r, RoadType rt)
static RoadTypes GetRoadTypes (TileIndex t)
static void SetRoadTypes (TileIndex t, RoadTypes rt)
static bool HasTileRoadType (TileIndex t, RoadType rt)
static Owner GetRoadOwner (TileIndex t, RoadType rt)
static void SetRoadOwner (TileIndex t, RoadType rt, Owner o)
 DECLARE_ENUM_AS_BIT_SET (DisallowedRoadDirections)
static DisallowedRoadDirections GetDisallowedRoadDirections (TileIndex t)
 Gets the disallowed directions.
static void SetDisallowedRoadDirections (TileIndex t, DisallowedRoadDirections drd)
 Sets the disallowed directions.
static Axis GetCrossingRoadAxis (TileIndex t)
static Axis GetCrossingRailAxis (TileIndex t)
static RoadBits GetCrossingRoadBits (TileIndex tile)
static Track GetCrossingRailTrack (TileIndex tile)
static TrackBits GetCrossingRailBits (TileIndex tile)
static bool IsCrossingBarred (TileIndex t)
static void SetCrossingBarred (TileIndex t, bool barred)
static void UnbarCrossing (TileIndex t)
static void BarCrossing (TileIndex t)
static bool IsOnSnow (TileIndex t)
static void ToggleSnow (TileIndex t)
static Roadside GetRoadside (TileIndex tile)
static void SetRoadside (TileIndex tile, Roadside s)
static bool HasRoadWorks (TileIndex t)
static bool IncreaseRoadWorksCounter (TileIndex t)
static void StartRoadWorks (TileIndex t)
static void TerminateRoadWorks (TileIndex t)
static DiagDirection GetRoadDepotDirection (TileIndex t)
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.

TrackBits GetAnyRoadTrackBits (TileIndex tile, RoadType rt)
 Get the accessible track bits for the given tile.
bool IsPossibleCrossing (const TileIndex tile, Axis ax)
 Return if the tile is a valid tile for a crossing.
static void MakeRoadNormal (TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram, Owner hway)
static void MakeRoadCrossing (TileIndex t, Owner road, Owner tram, Owner hway, Owner rail, Axis roaddir, RailType rat, RoadTypes rot, uint town)
static void MakeRoadDepot (TileIndex t, Owner owner, DiagDirection dir, RoadType rt)


Detailed Description

Definition in file road_map.h.


Enumeration Type Documentation

Which directions are disallowed ?

Enumerator:
DRD_NONE  None of the directions are disallowed.
DRD_SOUTHBOUND  All southbound traffic is disallowed.
DRD_NORTHBOUND  All northbound traffic is disallowed.
DRD_BOTH  All directions are disallowed.

Definition at line 171 of file road_map.h.


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 17 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, and ROAD_Y.

Referenced by CanRemoveRoadWithStop(), CheckAllowRemoveRoad(), and CleanUpRoadBits().

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 46 of file road_map.cpp.

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

Referenced by GetTownRoadBits().

static DisallowedRoadDirections GetDisallowedRoadDirections ( TileIndex  t  )  [inline, static]

Gets the disallowed directions.

Parameters:
t the tile to get the directions from
Returns:
the disallowed directions

Definition at line 185 of file road_map.h.

References _m, and GB().

Referenced by CmdBuildRoad(), CmdBuildSingleRail(), CmdTurnRoadVeh(), and DrawRoadBits().

bool IsPossibleCrossing ( const TileIndex  tile,
Axis  ax 
)

Return if the tile is a valid tile for a crossing.

Note:
function is overloaded
Parameters:
tile the curent tile
ax the axis of the road over the rail
Returns:
true if it is a valid tile

Definition at line 16 of file road.cpp.

References AXIS_X, GetTrackBits(), HasSignals(), IsTileType(), MP_RAILWAY, SLOPE_FLAT, TRACK_BIT_X, and TRACK_BIT_Y.

static void SetDisallowedRoadDirections ( TileIndex  t,
DisallowedRoadDirections  drd 
) [inline, static]

Sets the disallowed directions.

Parameters:
t the tile to set the directions for
drd the disallowed directions

Definition at line 196 of file road_map.h.

References _m, and SB().

Referenced by CmdBuildRoad(), and RemoveRoad().


Generated on Wed Oct 1 17:03:30 2008 for openttd by  doxygen 1.5.6