OpenTTD Source  1.11.2
road_map.h File Reference
#include "track_func.h"
#include "depot_type.h"
#include "rail_type.h"
#include "road_func.h"
#include "tile_map.h"

Go to the source code of this file.

Data Structures

struct  EnumPropsT< DisallowedRoadDirections >
 Helper information for extract tool. More...
 

Macros

#define IsOnDesert   IsOnSnow
 Check if a road tile has snow/desert.
 
#define ToggleDesert   ToggleSnow
 Toggle the snow/desert state of a road tile.
 

Enumerations

enum  RoadTileType { ROAD_TILE_NORMAL, ROAD_TILE_CROSSING, ROAD_TILE_DEPOT }
 The different types of road tiles. More...
 
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
}
 The possible road side decorations. More...
 

Functions

static bool MayHaveRoad (TileIndex t)
 Test whether a tile can have road/tram types. More...
 
static RoadTileType GetRoadTileType (TileIndex t)
 Get the type of the road tile. More...
 
static bool IsNormalRoad (TileIndex t)
 Return whether a tile is a normal road. More...
 
static bool IsNormalRoadTile (TileIndex t)
 Return whether a tile is a normal road tile. More...
 
static bool IsLevelCrossing (TileIndex t)
 Return whether a tile is a level crossing. More...
 
static bool IsLevelCrossingTile (TileIndex t)
 Return whether a tile is a level crossing tile. More...
 
static bool IsRoadDepot (TileIndex t)
 Return whether a tile is a road depot. More...
 
static bool IsRoadDepotTile (TileIndex t)
 Return whether a tile is a road depot tile. More...
 
static RoadBits GetRoadBits (TileIndex t, RoadTramType rtt)
 Get the present road bits for a specific road type. More...
 
static RoadBits GetAllRoadBits (TileIndex tile)
 Get all set RoadBits on the given tile. More...
 
static void SetRoadBits (TileIndex t, RoadBits r, RoadTramType rtt)
 Set the present road bits for a specific road type. More...
 
static RoadType GetRoadTypeRoad (TileIndex t)
 
static RoadType GetRoadTypeTram (TileIndex t)
 
static RoadType GetRoadType (TileIndex t, RoadTramType rtt)
 
static RoadTypes GetPresentRoadTypes (TileIndex t)
 Get the present road types of a tile. More...
 
static bool HasRoadTypeRoad (TileIndex t)
 
static bool HasRoadTypeTram (TileIndex t)
 
static bool HasTileRoadType (TileIndex t, RoadTramType rtt)
 Check if a tile has a road or a tram road type. More...
 
static bool HasTileAnyRoadType (TileIndex t, RoadTypes rts)
 Check if a tile has one of the specified road types. More...
 
static Owner GetRoadOwner (TileIndex t, RoadTramType rtt)
 Get the owner of a specific road type. More...
 
static void SetRoadOwner (TileIndex t, RoadTramType rtt, Owner o)
 Set the owner of a specific road type. More...
 
static bool IsRoadOwner (TileIndex t, RoadTramType rtt, Owner o)
 Check if a specific road type is owned by an owner. More...
 
static bool HasTownOwnedRoad (TileIndex t)
 Checks if given tile has town owned road. More...
 
static DisallowedRoadDirections GetDisallowedRoadDirections (TileIndex t)
 Gets the disallowed directions. More...
 
static void SetDisallowedRoadDirections (TileIndex t, DisallowedRoadDirections drd)
 Sets the disallowed directions. More...
 
static Axis GetCrossingRoadAxis (TileIndex t)
 Get the road axis of a level crossing. More...
 
static Axis GetCrossingRailAxis (TileIndex t)
 Get the rail axis of a level crossing. More...
 
static RoadBits GetCrossingRoadBits (TileIndex tile)
 Get the road bits of a level crossing. More...
 
static Track GetCrossingRailTrack (TileIndex tile)
 Get the rail track of a level crossing. More...
 
static TrackBits GetCrossingRailBits (TileIndex tile)
 Get the rail track bits of a level crossing. More...
 
static bool HasCrossingReservation (TileIndex t)
 Get the reservation state of the rail crossing. More...
 
static void SetCrossingReservation (TileIndex t, bool b)
 Set the reservation state of the rail crossing. More...
 
static TrackBits GetCrossingReservationTrackBits (TileIndex t)
 Get the reserved track bits for a rail crossing. More...
 
static bool IsCrossingBarred (TileIndex t)
 Check if the level crossing is barred. More...
 
static void SetCrossingBarred (TileIndex t, bool barred)
 Set the bar state of a level crossing. More...
 
static void UnbarCrossing (TileIndex t)
 Unbar a level crossing. More...
 
static void BarCrossing (TileIndex t)
 Bar a level crossing. More...
 
static bool IsOnSnow (TileIndex t)
 Check if a road tile has snow/desert. More...
 
static void ToggleSnow (TileIndex t)
 Toggle the snow/desert state of a road tile. More...
 
static Roadside GetRoadside (TileIndex tile)
 Get the decorations of a road. More...
 
static void SetRoadside (TileIndex tile, Roadside s)
 Set the decorations of a road. More...
 
static bool HasRoadWorks (TileIndex t)
 Check if a tile has road works. More...
 
static bool IncreaseRoadWorksCounter (TileIndex t)
 Increase the progress counter of road works. More...
 
static void StartRoadWorks (TileIndex t)
 Start road works on a tile. More...
 
static void TerminateRoadWorks (TileIndex t)
 Terminate road works on a tile. More...
 
static DiagDirection GetRoadDepotDirection (TileIndex t)
 Get the direction of the exit of a road depot. More...
 
RoadBits GetAnyRoadBits (TileIndex tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance=false)
 Returns the RoadBits on an arbitrary tile Special behaviour: More...
 
static void SetRoadTypeRoad (TileIndex t, RoadType rt)
 Set the road road type of a tile. More...
 
static void SetRoadTypeTram (TileIndex t, RoadType rt)
 Set the tram road type of a tile. More...
 
static void SetRoadType (TileIndex t, RoadTramType rtt, RoadType rt)
 Set the road type of a tile. More...
 
static void SetRoadTypes (TileIndex t, RoadType road_rt, RoadType tram_rt)
 Set the present road types of a tile. More...
 
static void MakeRoadNormal (TileIndex t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
 Make a normal road tile. More...
 
static void MakeRoadCrossing (TileIndex t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadType road_rt, RoadType tram_rt, uint town)
 Make a level crossing. More...
 
static void MakeRoadDepot (TileIndex t, Owner owner, DepotID did, DiagDirection dir, RoadType rt)
 Make a road depot. More...
 

Detailed Description

Map accessors for roads.

Definition in file road_map.h.

Enumeration Type Documentation

◆ DisallowedRoadDirections

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.

DRD_END 

Sentinel.

Definition at line 285 of file road_map.h.

◆ Roadside

enum Roadside

The possible road side decorations.

Enumerator
ROADSIDE_BARREN 

Road on barren land.

ROADSIDE_GRASS 

Road on grass.

ROADSIDE_PAVED 

Road with paved sidewalks.

ROADSIDE_STREET_LIGHTS 

Road with street lights on paved sidewalks.

ROADSIDE_TREES 

Road with trees on paved sidewalks.

ROADSIDE_GRASS_ROAD_WORKS 

Road on grass with road works.

ROADSIDE_PAVED_ROAD_WORKS 

Road with sidewalks and road works.

Definition at line 477 of file road_map.h.

◆ RoadTileType

The different types of road tiles.

Enumerator
ROAD_TILE_NORMAL 

Normal road.

ROAD_TILE_CROSSING 

Level crossing.

ROAD_TILE_DEPOT 

Depot (one entrance)

Definition at line 21 of file road_map.h.

Function Documentation

◆ BarCrossing()

static void BarCrossing ( TileIndex  t)
inlinestatic

Bar a level crossing.

Parameters
tThe tile to change.

Definition at line 447 of file road_map.h.

References SetCrossingBarred().

Referenced by MaybeBarCrossingWithSound(), and TryReserveRailTrack().

◆ GetAllRoadBits()

static RoadBits GetAllRoadBits ( TileIndex  tile)
inlinestatic

Get all set RoadBits on the given tile.

Parameters
tileThe tile from which we want to get the RoadBits
Returns
all set RoadBits of the tile

Definition at line 140 of file road_map.h.

References GetRoadBits().

◆ GetAnyRoadBits()

RoadBits GetAnyRoadBits ( TileIndex  tile,
RoadTramType  rtt,
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

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
tilethe tile to get the road bits for
rtthe road type to get the road bits form
straight_tunnel_bridge_entrancewhether to return straight road bits for tunnels/bridges.
Returns
the road bits of the given tile

Definition at line 33 of file road_map.cpp.

References AxisToRoadBits(), DIAGDIR_NE, DiagDirToAxis(), DiagDirToRoadBits(), GetCrossingRoadBits(), GetRoadBits(), GetRoadDepotDirection(), GetRoadStopDir(), GetRoadTileType(), GetTileType(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), HasTileRoadType(), IsDriveThroughStopTile(), IsRoadStopTile(), MayHaveRoad(), MP_ROAD, MP_STATION, MP_TUNNELBRIDGE, ReverseDiagDir(), ROAD_NONE, ROAD_TILE_CROSSING, ROAD_TILE_DEPOT, ROAD_TILE_NORMAL, ROAD_X, ROAD_Y, and TRANSPORT_ROAD.

Referenced by CleanUpRoadBits(), and GetTownRoadBits().

◆ GetCrossingRailAxis()

static Axis GetCrossingRailAxis ( TileIndex  t)
inlinestatic

Get the rail axis of a level crossing.

Parameters
tThe tile to query.
Precondition
IsLevelCrossing(t)
Returns
The axis of the rail.

Definition at line 337 of file road_map.h.

References GetCrossingRoadAxis(), IsLevelCrossing(), and OtherAxis().

Referenced by DrawTile_Road(), GetCrossingRailBits(), GetCrossingRailTrack(), and TrainApproachingCrossing().

◆ GetCrossingRailBits()

static TrackBits GetCrossingRailBits ( TileIndex  tile)
inlinestatic

Get the rail track bits of a level crossing.

Parameters
tileThe tile to query.
Returns
The rail track bits.

Definition at line 368 of file road_map.h.

References AxisToTrackBits(), and GetCrossingRailAxis().

Referenced by GetCrossingReservationTrackBits(), and GetRailTrackBitsUniversal().

◆ GetCrossingRailTrack()

static Track GetCrossingRailTrack ( TileIndex  tile)
inlinestatic

Get the rail track of a level crossing.

Parameters
tileThe tile to query.
Returns
The rail track.

Definition at line 358 of file road_map.h.

References AxisToTrack(), and GetCrossingRailAxis().

Referenced by CmdConvertRail().

◆ GetCrossingReservationTrackBits()

static TrackBits GetCrossingReservationTrackBits ( TileIndex  t)
inlinestatic

Get the reserved track bits for a rail crossing.

Parameters
tthe tile
Precondition
IsLevelCrossingTile(t)
Returns
reserved track bits

Definition at line 405 of file road_map.h.

References GetCrossingRailBits(), HasCrossingReservation(), and TRACK_BIT_NONE.

Referenced by GetReservedTrackbits().

◆ GetCrossingRoadAxis()

static Axis GetCrossingRoadAxis ( TileIndex  t)
inlinestatic

Get the road axis of a level crossing.

Parameters
tThe tile to query.
Precondition
IsLevelCrossing(t)
Returns
The axis of the road.

Definition at line 325 of file road_map.h.

References _m, GB(), and IsLevelCrossing().

Referenced by CanEnterTileOwnerCheck(), GetCrossingRailAxis(), GetCrossingRoadBits(), and TrainApproachingCrossingTile().

◆ GetCrossingRoadBits()

static RoadBits GetCrossingRoadBits ( TileIndex  tile)
inlinestatic

Get the road bits of a level crossing.

Parameters
tileThe tile to query.
Returns
The present road bits.

Definition at line 348 of file road_map.h.

References AXIS_X, GetCrossingRoadAxis(), ROAD_X, and ROAD_Y.

Referenced by GetAnyRoadBits().

◆ GetDisallowedRoadDirections()

static DisallowedRoadDirections GetDisallowedRoadDirections ( TileIndex  t)
inlinestatic

Gets the disallowed directions.

Parameters
tthe tile to get the directions from
Returns
the disallowed directions

Definition at line 301 of file road_map.h.

References _m, GB(), and IsNormalRoad().

Referenced by GrowTownWithBridge().

◆ GetPresentRoadTypes()

static RoadTypes GetPresentRoadTypes ( TileIndex  t)
inlinestatic

Get the present road types of a tile.

Parameters
tThe tile to query.
Returns
Present road types.

Definition at line 184 of file road_map.h.

References MayHaveRoad(), and ROADTYPES_NONE.

Referenced by HasTileAnyRoadType().

◆ GetRoadBits()

static RoadBits GetRoadBits ( TileIndex  t,
RoadTramType  rtt 
)
inlinestatic

Get the present road bits for a specific road type.

Parameters
tThe tile to query.
rtRoad type.
Precondition
IsNormalRoad(t)
Returns
The present road bits for the road type.

Definition at line 127 of file road_map.h.

References IsNormalRoad().

Referenced by ConnectRoadToStructure(), DrawRoadBits(), DrawRoadCatenary(), GetAllRoadBits(), GetAnyRoadBits(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::GetSingleTramBit(), and GetSingleTramBit().

◆ GetRoadDepotDirection()

◆ GetRoadOwner()

static Owner GetRoadOwner ( TileIndex  t,
RoadTramType  rtt 
)
inlinestatic

Get the owner of a specific road type.

Parameters
tThe tile to query.
rttRoadTramType.
Returns
Owner of the given road type.

Definition at line 233 of file road_map.h.

References MayHaveRoad().

Referenced by FixOwnerOfRailTrack(), and IsRoadOwner().

◆ GetRoadside()

static Roadside GetRoadside ( TileIndex  tile)
inlinestatic

Get the decorations of a road.

Parameters
tileThe tile to query.
Returns
The road decoration of the tile.

Definition at line 493 of file road_map.h.

References _me, and GB().

Referenced by HasRoadWorks(), StartRoadWorks(), and TerminateRoadWorks().

◆ GetRoadTileType()

static RoadTileType GetRoadTileType ( TileIndex  t)
inlinestatic

Get the type of the road tile.

Parameters
tTile to query.
Precondition
IsTileType(t, MP_ROAD)
Returns
The road tile type.

Definition at line 51 of file road_map.h.

References _m, GB(), IsTileType(), and MP_ROAD.

Referenced by DrawTile_Road(), GetAnyRoadBits(), IsLevelCrossing(), IsNormalRoad(), and IsRoadDepot().

◆ HasCrossingReservation()

static bool HasCrossingReservation ( TileIndex  t)
inlinestatic

Get the reservation state of the rail crossing.

Parameters
tthe crossing tile
Returns
reservation state
Precondition
IsLevelCrossingTile(t)

Definition at line 380 of file road_map.h.

References _m, HasBit(), and IsLevelCrossingTile().

Referenced by GetCrossingReservationTrackBits(), TryReserveRailTrack(), and UpdateLevelCrossing().

◆ HasRoadWorks()

static bool HasRoadWorks ( TileIndex  t)
inlinestatic

Check if a tile has road works.

Parameters
tThe tile to check.
Returns
True if the tile has road works in progress.

Definition at line 513 of file road_map.h.

References GetRoadside(), and ROADSIDE_GRASS_ROAD_WORKS.

Referenced by StartRoadWorks(), and TerminateRoadWorks().

◆ HasTileAnyRoadType()

static bool HasTileAnyRoadType ( TileIndex  t,
RoadTypes  rts 
)
inlinestatic

Check if a tile has one of the specified road types.

Parameters
tThe tile to check.
rtsAllowed road types.
Returns
True if the tile has one of the specified road types.

Definition at line 221 of file road_map.h.

References GetPresentRoadTypes(), and MayHaveRoad().

Referenced by CheckRoadBlockedForOvertaking(), CmdBuildRoadVehicle(), and RoadStop::GetNextRoadStop().

◆ HasTileRoadType()

static bool HasTileRoadType ( TileIndex  t,
RoadTramType  rtt 
)
inlinestatic

Check if a tile has a road or a tram road type.

Parameters
tThe tile to check.
tramTrue to check tram, false to check road.
Returns
True if the tile has the specified road type.

Definition at line 210 of file road_map.h.

Referenced by GetAnyRoadBits(), HasTownOwnedRoad(), and IsRoadOwner().

◆ HasTownOwnedRoad()

static bool HasTownOwnedRoad ( TileIndex  t)
inlinestatic

Checks if given tile has town owned road.

Parameters
ttile to check
Precondition
IsTileType(t, MP_ROAD)
Returns
true iff tile has road and the road is owned by a town

Definition at line 279 of file road_map.h.

References HasTileRoadType().

Referenced by ClosestTownFromTile(), UpdateNearestTownForRoadTiles(), and Town::~Town().

◆ IncreaseRoadWorksCounter()

static bool IncreaseRoadWorksCounter ( TileIndex  t)
inlinestatic

Increase the progress counter of road works.

Parameters
tThe tile to modify.
Returns
True if the road works are in the last stage.

Definition at line 523 of file road_map.h.

References _me, AB(), and GB().

◆ IsCrossingBarred()

static bool IsCrossingBarred ( TileIndex  t)
inlinestatic

Check if the level crossing is barred.

Parameters
tThe tile to query.
Precondition
IsLevelCrossing(t)
Returns
True if the level crossing is barred.

Definition at line 416 of file road_map.h.

References _m, HasBit(), and IsLevelCrossing().

Referenced by MaybeBarCrossingWithSound(), and UpdateLevelCrossing().

◆ IsLevelCrossing()

static bool IsLevelCrossing ( TileIndex  t)
inlinestatic

◆ IsLevelCrossingTile()

static bool IsLevelCrossingTile ( TileIndex  t)
inlinestatic

Return whether a tile is a level crossing tile.

Parameters
tTile to query.
Returns
True if level crossing tile.

Definition at line 94 of file road_map.h.

References IsLevelCrossing(), IsTileType(), and MP_ROAD.

Referenced by CmdConvertRail(), DeleteLastWagon(), FixOwnerOfRailTrack(), HasCrossingReservation(), SetCrossingReservation(), TrainApproachingCrossing(), TrainApproachingCrossingTile(), and UpdateLevelCrossing().

◆ IsNormalRoad()

static bool IsNormalRoad ( TileIndex  t)
inlinestatic

Return whether a tile is a normal road.

Parameters
tTile to query.
Precondition
IsTileType(t, MP_ROAD)
Returns
True if normal road.

Definition at line 63 of file road_map.h.

References GetRoadTileType(), and ROAD_TILE_NORMAL.

Referenced by DrawRoadCatenary(), GetDisallowedRoadDirections(), GetRoadBits(), IsNormalRoadTile(), SetDisallowedRoadDirections(), and SetRoadBits().

◆ IsNormalRoadTile()

static bool IsNormalRoadTile ( TileIndex  t)
inlinestatic

Return whether a tile is a normal road tile.

Parameters
tTile to query.
Returns
True if normal road tile.

Definition at line 73 of file road_map.h.

References IsNormalRoad(), IsTileType(), and MP_ROAD.

Referenced by CleanUpRoadBits(), ConnectRoadToStructure(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::GetSingleTramBit(), GetSingleTramBit(), and GrowTownWithBridge().

◆ IsOnSnow()

static bool IsOnSnow ( TileIndex  t)
inlinestatic

Check if a road tile has snow/desert.

Parameters
tThe tile to query.
Returns
True if the tile has snow/desert.

Definition at line 459 of file road_map.h.

References _me, and HasBit().

Referenced by DrawRoadAsSnowDesert().

◆ IsRoadDepot()

static bool IsRoadDepot ( TileIndex  t)
inlinestatic

Return whether a tile is a road depot.

Parameters
tTile to query.
Precondition
IsTileType(t, MP_ROAD)
Returns
True if road depot.

Definition at line 105 of file road_map.h.

References GetRoadTileType(), and ROAD_TILE_DEPOT.

Referenced by ClosestTownFromTile(), GetRoadDepotDirection(), GetTownIndex(), IsRoadDepotTile(), SetTownIndex(), and UpdateNearestTownForRoadTiles().

◆ IsRoadDepotTile()

static bool IsRoadDepotTile ( TileIndex  t)
inlinestatic

Return whether a tile is a road depot tile.

Parameters
tTile to query.
Returns
True if road depot tile.

Definition at line 115 of file road_map.h.

References IsRoadDepot(), IsTileType(), and MP_ROAD.

Referenced by CanEnterTileOwnerCheck(), GetDepotIndex(), GetTownRoadBits(), IsDepotTile(), CYapfCostRoadT< Types >::PfCalcCost(), and CYapfDestinationAnyDepotRoadT< Types >::PfDetectDestination().

◆ IsRoadOwner()

static bool IsRoadOwner ( TileIndex  t,
RoadTramType  rtt,
Owner  o 
)
inlinestatic

Check if a specific road type is owned by an owner.

Parameters
tThe tile to query.
tramTrue to check tram, false to check road.
oOwner to compare with.
Precondition
HasTileRoadType(t, rt)
Returns
True if the road type is owned by the given owner.

Definition at line 267 of file road_map.h.

References GetRoadOwner(), and HasTileRoadType().

◆ MakeRoadCrossing()

static void MakeRoadCrossing ( TileIndex  t,
Owner  road,
Owner  tram,
Owner  rail,
Axis  roaddir,
RailType  rat,
RoadType  road_rt,
RoadType  tram_rt,
uint  town 
)
inlinestatic

Make a level crossing.

Parameters
tTile to make a level crossing.
roadNew owner of road.
tramNew owner of tram tracks.
railNew owner of the rail track.
roaddirAxis of the road.
ratNew rail type.
road_rtThe road roadtype to set for the tile.
tram_rtThe tram roadtype to set for the tile.
townTown ID if the road is a town-owned road.

Definition at line 660 of file road_map.h.

References _m, _me, INVALID_ROADTYPE, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, TileExtended::m8, MP_ROAD, ROAD_TILE_CROSSING, SB(), SetRoadOwner(), SetRoadTypes(), SetTileOwner(), and SetTileType().

◆ MakeRoadDepot()

static void MakeRoadDepot ( TileIndex  t,
Owner  owner,
DepotID  did,
DiagDirection  dir,
RoadType  rt 
)
inlinestatic

Make a road depot.

Parameters
tTile to make a level crossing.
ownerNew owner of the depot.
didNew depot ID.
dirDirection of the depot exit.*
rtRoad type of the depot.

Definition at line 683 of file road_map.h.

References _m, _me, INVALID_ROADTYPE, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, TileExtended::m8, MP_ROAD, Window::owner, ROAD_TILE_DEPOT, SB(), SetRoadType(), SetTileOwner(), and SetTileType().

◆ MakeRoadNormal()

static void MakeRoadNormal ( TileIndex  t,
RoadBits  bits,
RoadType  road_rt,
RoadType  tram_rt,
TownID  town,
Owner  road,
Owner  tram 
)
inlinestatic

Make a normal road tile.

Parameters
tTile to make a normal road.
bitsRoad bits to set for all present road types.
road_rtThe road roadtype to set for the tile.
tram_rtThe tram roadtype to set for the tile.
townTown ID if the road is a town-owned road.
roadNew owner of road.
tramNew owner of tram tracks.

Definition at line 635 of file road_map.h.

References _m, _me, INVALID_ROADTYPE, Tile::m2, Tile::m3, Tile::m5, TileExtended::m7, MP_ROAD, ROAD_TILE_NORMAL, SB(), SetRoadOwner(), SetRoadTypes(), SetTileOwner(), and SetTileType().

◆ MayHaveRoad()

static bool MayHaveRoad ( TileIndex  t)
inlinestatic

Test whether a tile can have road/tram types.

Parameters
tTile to query.
Returns
true if tile can be queried about road/tram types.

Definition at line 32 of file road_map.h.

References GetTileType(), MP_ROAD, MP_STATION, and MP_TUNNELBRIDGE.

Referenced by CanConnectToRoad(), DrawRoadTypeCatenary(), GetAnyRoadBits(), GetPresentRoadTypes(), GetRoadOwner(), HasTileAnyRoadType(), RemoveRoad(), SetRoadTypeRoad(), and SetRoadTypeTram().

◆ SetCrossingBarred()

static void SetCrossingBarred ( TileIndex  t,
bool  barred 
)
inlinestatic

Set the bar state of a level crossing.

Parameters
tThe tile to modify.
barredTrue if the crossing should be barred, false otherwise.
Precondition
IsLevelCrossing(t)

Definition at line 428 of file road_map.h.

References _m, IsLevelCrossing(), and SB().

Referenced by BarCrossing(), and UnbarCrossing().

◆ SetCrossingReservation()

static void SetCrossingReservation ( TileIndex  t,
bool  b 
)
inlinestatic

Set the reservation state of the rail crossing.

Note
Works for both waypoints and rail depots
Parameters
tthe crossing tile
bthe reservation state
Precondition
IsLevelCrossingTile(t)

Definition at line 393 of file road_map.h.

References _m, IsLevelCrossingTile(), and SB().

Referenced by TryReserveRailTrack(), and UnreserveRailTrack().

◆ SetDisallowedRoadDirections()

static void SetDisallowedRoadDirections ( TileIndex  t,
DisallowedRoadDirections  drd 
)
inlinestatic

Sets the disallowed directions.

Parameters
tthe tile to set the directions for
drdthe disallowed directions

Definition at line 312 of file road_map.h.

References _m, DRD_END, IsNormalRoad(), and SB().

◆ SetRoadBits()

static void SetRoadBits ( TileIndex  t,
RoadBits  r,
RoadTramType  rtt 
)
inlinestatic

Set the present road bits for a specific road type.

Parameters
tThe tile to change.
rThe new road bits.
rtRoad type.
Precondition
IsNormalRoad(t)

Definition at line 152 of file road_map.h.

References IsNormalRoad().

◆ SetRoadOwner()

static void SetRoadOwner ( TileIndex  t,
RoadTramType  rtt,
Owner  o 
)
inlinestatic

Set the owner of a specific road type.

Parameters
tThe tile to change.
rttRoadTramType.
oNew owner of the given road type.

Definition at line 250 of file road_map.h.

Referenced by ConvertRoadTypeOwner(), MakeRoadBridgeRamp(), MakeRoadCrossing(), MakeRoadNormal(), and MakeRoadTunnel().

◆ SetRoadside()

static void SetRoadside ( TileIndex  tile,
Roadside  s 
)
inlinestatic

Set the decorations of a road.

Parameters
tileThe tile to change.
sThe new road decoration of the tile.

Definition at line 503 of file road_map.h.

References _me, and SB().

Referenced by StartRoadWorks(), and TerminateRoadWorks().

◆ SetRoadType()

static void SetRoadType ( TileIndex  t,
RoadTramType  rtt,
RoadType  rt 
)
inlinestatic

Set the road type of a tile.

Parameters
tThe tile to change.
rttSet road or tram type.
rtThe road type to set.

Definition at line 604 of file road_map.h.

Referenced by MakeRoadDepot().

◆ SetRoadTypeRoad()

static void SetRoadTypeRoad ( TileIndex  t,
RoadType  rt 
)
inlinestatic

Set the road road type of a tile.

Parameters
tThe tile to change.
rtThe road type to set.

Definition at line 579 of file road_map.h.

References INVALID_ROADTYPE, and MayHaveRoad().

Referenced by SetRoadTypes().

◆ SetRoadTypes()

static void SetRoadTypes ( TileIndex  t,
RoadType  road_rt,
RoadType  tram_rt 
)
inlinestatic

Set the present road types of a tile.

Parameters
tThe tile to change.
road_rtThe road roadtype to set for the tile.
tram_rtThe tram roadtype to set for the tile.

Definition at line 619 of file road_map.h.

References SetRoadTypeRoad(), and SetRoadTypeTram().

Referenced by MakeRailTunnel(), MakeRoadCrossing(), and MakeRoadNormal().

◆ SetRoadTypeTram()

static void SetRoadTypeTram ( TileIndex  t,
RoadType  rt 
)
inlinestatic

Set the tram road type of a tile.

Parameters
tThe tile to change.
rtThe road type to set.

Definition at line 591 of file road_map.h.

References INVALID_ROADTYPE, and MayHaveRoad().

Referenced by SetRoadTypes().

◆ StartRoadWorks()

static void StartRoadWorks ( TileIndex  t)
inlinestatic

Start road works on a tile.

Parameters
tThe tile to start the work on.
Precondition
!HasRoadWorks(t)

Definition at line 535 of file road_map.h.

References GetRoadside(), HasRoadWorks(), ROADSIDE_BARREN, ROADSIDE_GRASS, ROADSIDE_GRASS_ROAD_WORKS, ROADSIDE_PAVED_ROAD_WORKS, and SetRoadside().

◆ TerminateRoadWorks()

static void TerminateRoadWorks ( TileIndex  t)
inlinestatic

Terminate road works on a tile.

Parameters
tTile to stop the road works on.
Precondition
HasRoadWorks(t)

Definition at line 551 of file road_map.h.

References _me, GetRoadside(), HasRoadWorks(), ROADSIDE_GRASS, ROADSIDE_GRASS_ROAD_WORKS, SB(), and SetRoadside().

◆ ToggleSnow()

static void ToggleSnow ( TileIndex  t)
inlinestatic

Toggle the snow/desert state of a road tile.

Parameters
tThe tile to change.

Definition at line 470 of file road_map.h.

References _me, and ToggleBit().

◆ UnbarCrossing()

static void UnbarCrossing ( TileIndex  t)
inlinestatic

Unbar a level crossing.

Parameters
tThe tile to change.

Definition at line 438 of file road_map.h.

References SetCrossingBarred().