OpenTTD Source 20241224-master-gf74b0cf984
road_map.h File Reference

Map accessors for roads. More...

#include "track_func.h"
#include "depot_type.h"
#include "rail_type.h"
#include "road_func.h"
#include "tile_map.h"
#include "road_type.h"

Go to the source code of this file.

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  Roadside : uint8_t {
  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

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

Detailed Description

Map accessors for roads.

Definition in file road_map.h.

Macro Definition Documentation

◆ IsOnDesert

#define IsOnDesert   IsOnSnow

Check if a road tile has snow/desert.

Definition at line 453 of file road_map.h.

◆ ToggleDesert

#define ToggleDesert   ToggleSnow

Toggle the snow/desert state of a road tile.

Definition at line 465 of file road_map.h.

Enumeration Type Documentation

◆ Roadside

enum Roadside : uint8_t

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 22 of file road_map.h.

Function Documentation

◆ BarCrossing()

void BarCrossing ( Tile  t)
inline

Bar a level crossing.

Parameters
tThe tile to change.

Definition at line 447 of file road_map.h.

References SetCrossingBarred().

◆ GetAllRoadBits()

RoadBits GetAllRoadBits ( Tile  tile)
inline

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 141 of file road_map.h.

References GetRoadBits().

Referenced by CheckFlatLandRoadStop(), and GetAxisForNewRoadWaypoint().

◆ GetAnyRoadBits()

RoadBits GetAnyRoadBits ( Tile  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(), DiagDirToAxis(), DiagDirToRoadBits(), GetBayRoadStopDir(), GetCrossingRoadBits(), GetDriveThroughStopAxis(), GetRoadBits(), GetRoadDepotDirection(), GetRoadTileType(), GetTileType(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), HasTileRoadType(), IsAnyRoadStopTile(), IsDriveThroughStopTile(), MayHaveRoad(), MP_ROAD, MP_STATION, MP_TUNNELBRIDGE, ReverseDiagDir(), ROAD_NONE, ROAD_TILE_CROSSING, ROAD_TILE_DEPOT, ROAD_TILE_NORMAL, and TRANSPORT_ROAD.

Referenced by CanConnectToRoad(), CanRemoveRoadWithStop(), CheckAllowRemoveRoad(), CleanUpRoadBits(), CmdBuildRoad(), CmdConvertRoad(), GetTownRoadBits(), and RoadFindPathToDest().

◆ GetCrossingRailAxis()

Axis GetCrossingRailAxis ( Tile  t)
inline

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 DrawRoadCatenary(), DrawTile_Road(), GetCrossingRailBits(), GetCrossingRailTrack(), and TrainApproachingCrossing().

◆ GetCrossingRailBits()

TrackBits GetCrossingRailBits ( Tile  tile)
inline

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 CmdBuildSingleRail(), CmdRemoveSingleRail(), GetCrossingReservationTrackBits(), GetRailTrackBitsUniversal(), and RemoveRoad().

◆ GetCrossingRailTrack()

Track GetCrossingRailTrack ( Tile  tile)
inline

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(), and RemoveRoad().

◆ GetCrossingReservationTrackBits()

TrackBits GetCrossingReservationTrackBits ( Tile  t)
inline

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()

Axis GetCrossingRoadAxis ( Tile  t)
inline

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 GB(), IsLevelCrossing(), and Tile::m5().

Referenced by CmdBuildRoad(), CmdBuildSingleRail(), CmdRemoveSingleRail(), DrawTile_Road(), ExploreSegment(), GetCrossingRailAxis(), GetCrossingRoadBits(), MarkDirtyAdjacentLevelCrossingTiles(), RemoveRoad(), TrainApproachingCrossingTile(), UpdateAdjacentLevelCrossingTilesOnLevelCrossingRemoval(), and UpdateLevelCrossing().

◆ GetCrossingRoadBits()

RoadBits GetCrossingRoadBits ( Tile  tile)
inline

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 CmdBuildRoad(), CmdRemoveSingleRail(), FixOwnerOfRailTrack(), GetAnyRoadBits(), and RemoveRoad().

◆ GetDisallowedRoadDirections()

DisallowedRoadDirections GetDisallowedRoadDirections ( Tile  t)
inline

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 GB(), IsNormalRoad(), and Tile::m5().

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

◆ GetPresentRoadTypes()

RoadTypes GetPresentRoadTypes ( Tile  t)
inline

Get the present road types of a tile.

Parameters
tThe tile to query.
Returns
Present road types.

Definition at line 185 of file road_map.h.

References INVALID_ROADTYPE, MayHaveRoad(), ROADTYPES_NONE, and SetBit().

Referenced by HasTileAnyRoadType().

◆ GetRoadBits()

RoadBits GetRoadBits ( Tile  t,
RoadTramType  rtt 
)
inline

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 128 of file road_map.h.

References GB(), IsNormalRoad(), Tile::m3(), and Tile::m5().

Referenced by CheckFlatLandRoadStop(), CmdBuildRoad(), CmdBuildRoadStop(), CmdBuildRoadWaypoint(), CmdBuildSingleRail(), ConnectRoadToStructure(), DrawRoadBits(), DrawRoadCatenary(), GetAllRoadBits(), GetAnyRoadBits(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::GetSingleTramBit(), GetTrackdirBitsForRoad(), and RemoveRoad().

◆ GetRoadDepotDirection()

◆ GetRoadOwner()

◆ GetRoadside()

Roadside GetRoadside ( Tile  tile)
inline

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 GB(), and Tile::m6().

Referenced by DoClearBridge(), DrawRoadBits(), DrawTile_Road(), HasRoadWorks(), StartRoadWorks(), and TerminateRoadWorks().

◆ GetRoadTileType()

static debug_inline RoadTileType GetRoadTileType ( Tile  t)
static

Get the type of the road tile.

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

Definition at line 52 of file road_map.h.

References GB(), IsTileType(), Tile::m5(), and MP_ROAD.

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

◆ GetRoadType()

RoadType GetRoadType ( Tile  t,
RoadTramType  rtt 
)
inline

Definition at line 175 of file road_map.h.

◆ GetRoadTypeRoad()

RoadType GetRoadTypeRoad ( Tile  t)
inline

Definition at line 163 of file road_map.h.

◆ GetRoadTypeTram()

RoadType GetRoadTypeTram ( Tile  t)
inline

Definition at line 169 of file road_map.h.

◆ HasCrossingReservation()

bool HasCrossingReservation ( Tile  t)
inline

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 HasBit(), IsLevelCrossingTile(), and Tile::m5().

Referenced by CheckLevelCrossing(), DrawTile_Road(), GetCrossingReservationTrackBits(), RemoveRoad(), TrainController(), and TryReserveRailTrack().

◆ HasRoadTypeRoad()

bool HasRoadTypeRoad ( Tile  t)
inline

Definition at line 195 of file road_map.h.

◆ HasRoadTypeTram()

bool HasRoadTypeTram ( Tile  t)
inline

Definition at line 200 of file road_map.h.

◆ HasRoadWorks()

bool HasRoadWorks ( Tile  t)
inline

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 CmdBuildRoad(), CmdBuildSingleRail(), DrawRoadBits(), RemoveRoad(), StartRoadWorks(), and TerminateRoadWorks().

◆ HasTileAnyRoadType()

bool HasTileAnyRoadType ( Tile  t,
RoadTypes  rts 
)
inline

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 222 of file road_map.h.

References GetPresentRoadTypes(), and MayHaveRoad().

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

◆ HasTileRoadType()

bool HasTileRoadType ( Tile  t,
RoadTramType  rtt 
)
inline

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 211 of file road_map.h.

References INVALID_ROADTYPE.

Referenced by ClearTile_Station(), CmdBuildRoad(), GetAnyRoadBits(), GrowTownAtRoad(), HasTownOwnedRoad(), and IsRoadOwner().

◆ HasTownOwnedRoad()

bool HasTownOwnedRoad ( Tile  t)
inline

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 280 of file road_map.h.

References HasTileRoadType(), IsRoadOwner(), and OWNER_TOWN.

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

◆ IncreaseRoadWorksCounter()

bool IncreaseRoadWorksCounter ( Tile  t)
inline

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 AB(), GB(), and Tile::m7().

◆ IsCrossingBarred()

bool IsCrossingBarred ( Tile  t)
inline

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 HasBit(), IsLevelCrossing(), and Tile::m5().

Referenced by DrawTile_Road(), RailTypeScopeResolver::GetVariable(), RoadTypeScopeResolver::GetVariable(), MaybeBarCrossingWithSound(), UpdateAdjacentLevelCrossingTilesOnLevelCrossingRemoval(), and UpdateLevelCrossingTile().

◆ IsLevelCrossing()

◆ IsLevelCrossingTile()

◆ IsNormalRoad()

static debug_inline bool IsNormalRoad ( Tile  t)
static

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 64 of file road_map.h.

References GetRoadTileType(), and ROAD_TILE_NORMAL.

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

◆ IsNormalRoadTile()

◆ IsOnSnow()

bool IsOnSnow ( Tile  t)
inline

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 HasBit(), and Tile::m7().

Referenced by DrawRoadBits(), DrawTile_Road(), and GetTerrainType().

◆ IsRoadDepot()

static debug_inline bool IsRoadDepot ( Tile  t)
static

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 106 of file road_map.h.

References GetRoadTileType(), and ROAD_TILE_DEPOT.

Referenced by AfterLoadGame(), CanRoadContinueIntoNextTile(), ClosestTownFromTile(), CmdBuildBridge(), CmdConvertRoad(), GetRoadDepotDirection(), GetTownIndex(), GrowTownAtRoad(), IsRoadDepotTile(), RoadFindPathToDest(), SetTownIndex(), and UpdateNearestTownForRoadTiles().

◆ IsRoadDepotTile()

static debug_inline bool IsRoadDepotTile ( Tile  t)
static

◆ IsRoadOwner()

bool IsRoadOwner ( Tile  t,
RoadTramType  rtt,
Owner  o 
)
inline

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 268 of file road_map.h.

References GetRoadOwner(), and HasTileRoadType().

Referenced by GrowTownAtRoad(), HasTownOwnedRoad(), and RemoveRoad().

◆ IsValidDisallowedRoadDirections()

bool IsValidDisallowedRoadDirections ( DisallowedRoadDirections  drt)
inline

Checks if a DisallowedRoadDirections is valid.

Parameters
wcThe value to check
Returns
true if the given value is a valid DisallowedRoadDirections.

Definition at line 291 of file road_map.h.

References DRD_END.

Referenced by CmdBuildLongRoad(), and CmdBuildRoad().

◆ MakeRoadCrossing()

void MakeRoadCrossing ( Tile  t,
Owner  road,
Owner  tram,
Owner  rail,
Axis  roaddir,
RailType  rat,
RoadType  road_rt,
RoadType  tram_rt,
uint  town 
)
inline

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 INVALID_ROADTYPE, Tile::m2(), Tile::m3(), Tile::m4(), Tile::m5(), Tile::m6(), Tile::m7(), Tile::m8(), MP_ROAD, ROAD_TILE_CROSSING, SB(), SetRoadOwner(), SetRoadTypes(), SetTileOwner(), and SetTileType().

Referenced by CmdBuildRoad(), and CmdBuildSingleRail().

◆ MakeRoadDepot()

void MakeRoadDepot ( Tile  tile,
Owner  owner,
DepotID  depot_id,
DiagDirection  dir,
RoadType  rt 
)
inline

Make a road depot.

Parameters
tileTile to make a depot on.
ownerNew owner of the depot.
depot_idNew depot ID.
dirDirection of the depot exit.
rtRoad type of the depot.

Definition at line 694 of file road_map.h.

References INVALID_ROADTYPE, Tile::m2(), Tile::m3(), Tile::m4(), Tile::m5(), Tile::m6(), Tile::m7(), Tile::m8(), MP_ROAD, ROAD_TILE_DEPOT, SB(), SetRoadOwner(), SetRoadType(), SetTileOwner(), and SetTileType().

Referenced by CmdBuildRoadDepot().

◆ MakeRoadNormal()

void MakeRoadNormal ( Tile  t,
RoadBits  bits,
RoadType  road_rt,
RoadType  tram_rt,
TownID  town,
Owner  road,
Owner  tram 
)
inline

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 INVALID_ROADTYPE, Tile::m2(), Tile::m3(), Tile::m5(), Tile::m6(), Tile::m7(), MP_ROAD, ROAD_TILE_NORMAL, SB(), SetRoadOwner(), SetRoadTypes(), SetTileOwner(), and SetTileType().

Referenced by CmdBuildRoad(), CmdRemoveSingleRail(), and RemoveGenericRoadStop().

◆ MayHaveRoad()

bool MayHaveRoad ( Tile  t)
inline

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 33 of file road_map.h.

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

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

◆ SetCrossingBarred()

void SetCrossingBarred ( Tile  t,
bool  barred 
)
inline

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 AssignBit(), IsLevelCrossing(), and Tile::m5().

Referenced by BarCrossing(), UnbarCrossing(), UpdateAdjacentLevelCrossingTilesOnLevelCrossingRemoval(), and UpdateLevelCrossingTile().

◆ SetCrossingReservation()

void SetCrossingReservation ( Tile  t,
bool  b 
)
inline

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 AssignBit(), IsLevelCrossingTile(), and Tile::m5().

Referenced by AfterLoadGame(), CmdBuildRoad(), MaybeBarCrossingWithSound(), TryReserveRailTrack(), and UnreserveRailTrack().

◆ SetDisallowedRoadDirections()

void SetDisallowedRoadDirections ( Tile  t,
DisallowedRoadDirections  drd 
)
inline

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 DRD_END, IsNormalRoad(), Tile::m5(), and SB().

Referenced by CmdBuildRoad(), and RemoveRoad().

◆ SetRoadBits()

void SetRoadBits ( Tile  t,
RoadBits  r,
RoadTramType  rtt 
)
inline

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 153 of file road_map.h.

References IsNormalRoad(), Tile::m3(), Tile::m5(), and SB().

Referenced by CmdBuildRoad(), and RemoveRoad().

◆ SetRoadDepotExitDirection()

void SetRoadDepotExitDirection ( Tile  tile,
DiagDirection  dir 
)
inline

Sets the exit direction of a road depot.

Parameters
tileTile of the depot.
dirDirection of the depot exit.

Definition at line 680 of file road_map.h.

References IsRoadDepotTile(), Tile::m5(), and SB().

Referenced by CmdBuildRoadDepot().

◆ SetRoadOwner()

void SetRoadOwner ( Tile  t,
RoadTramType  rtt,
Owner  o 
)
inline

Set the owner of a specific road type.

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

Definition at line 251 of file road_map.h.

References IsNormalRoadTile(), Tile::m1(), Tile::m3(), Tile::m7(), OWNER_NONE, OWNER_TOWN, and SB().

Referenced by AfterLoadGame(), CmdBuildRoad(), ConvertRoadTypeOwner(), FixOwnerOfRailTrack(), GrowTownAtRoad(), MakeDriveThroughRoadStop(), MakeRoadBridgeRamp(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), MakeRoadStop(), and MakeRoadTunnel().

◆ SetRoadside()

void SetRoadside ( Tile  tile,
Roadside  s 
)
inline

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 Tile::m6(), and SB().

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

◆ SetRoadType()

void SetRoadType ( Tile  t,
RoadTramType  rtt,
RoadType  rt 
)
inline

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.

References SetRoadTypeRoad(), and SetRoadTypeTram().

Referenced by CmdBuildRoad(), CmdConvertRoad(), MakeRoadDepot(), and RemoveRoad().

◆ SetRoadTypeRoad()

void SetRoadTypeRoad ( Tile  t,
RoadType  rt 
)
inline

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, Tile::m4(), MayHaveRoad(), and SB().

Referenced by ConvertRoadTypes(), SetRoadType(), and SetRoadTypes().

◆ SetRoadTypes()

void SetRoadTypes ( Tile  t,
RoadType  road_rt,
RoadType  tram_rt 
)
inline

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 AfterLoadGame(), MakeDriveThroughRoadStop(), MakeRailTunnel(), MakeRoadBridgeRamp(), MakeRoadCrossing(), MakeRoadNormal(), MakeRoadStop(), and MakeRoadTunnel().

◆ SetRoadTypeTram()

void SetRoadTypeTram ( Tile  t,
RoadType  rt 
)
inline

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, Tile::m8(), MayHaveRoad(), and SB().

Referenced by ConvertRoadTypes(), SetRoadType(), and SetRoadTypes().

◆ StartRoadWorks()

void StartRoadWorks ( Tile  t)
inline

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()

void TerminateRoadWorks ( Tile  t)
inline

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 GetRoadside(), HasRoadWorks(), Tile::m7(), ROADSIDE_GRASS, ROADSIDE_GRASS_ROAD_WORKS, SB(), and SetRoadside().

◆ ToggleSnow()

void ToggleSnow ( Tile  t)
inline

Toggle the snow/desert state of a road tile.

Parameters
tThe tile to change.

Definition at line 470 of file road_map.h.

References Tile::m7(), and ToggleBit().

◆ UnbarCrossing()

void UnbarCrossing ( Tile  t)
inline

Unbar a level crossing.

Parameters
tThe tile to change.

Definition at line 438 of file road_map.h.

References SetCrossingBarred().