OpenTTD
|
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"
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. More... | |
#define | ToggleDesert ToggleSnow |
Toggle the snow/desert state of a road tile. More... | |
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 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, RoadType rt) |
Get the present road bits for a specific road type. More... | |
static RoadBits | GetOtherRoadBits (TileIndex t, RoadType rt) |
Get all RoadBits set on a tile except from the given RoadType. More... | |
static RoadBits | GetAllRoadBits (TileIndex tile) |
Get all set RoadBits on the given tile. More... | |
static void | SetRoadBits (TileIndex t, RoadBits r, RoadType rt) |
Set the present road bits for a specific road type. More... | |
static RoadTypes | GetRoadTypes (TileIndex t) |
Get the present road types of a tile. More... | |
static void | SetRoadTypes (TileIndex t, RoadTypes rt) |
Set the present road types of a tile. More... | |
static bool | HasTileRoadType (TileIndex t, RoadType rt) |
Check if a tile has a specific road type. More... | |
static Owner | GetRoadOwner (TileIndex t, RoadType rt) |
Get the owner of a specific road type. More... | |
static void | SetRoadOwner (TileIndex t, RoadType rt, Owner o) |
Set the owner of a specific road type. More... | |
static bool | IsRoadOwner (TileIndex t, RoadType rt, 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, RoadType rt, bool straight_tunnel_bridge_entrance=false) |
Returns the RoadBits on an arbitrary tile Special behaviour: More... | |
static void | MakeRoadNormal (TileIndex t, RoadBits bits, RoadTypes rot, 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, RoadTypes rot, 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... | |
Map accessors for roads.
Definition in file road_map.h.
#define IsOnDesert IsOnSnow |
Check if a road tile has snow/desert.
Definition at line 423 of file road_map.h.
#define ToggleDesert ToggleSnow |
Toggle the snow/desert state of a road tile.
Definition at line 435 of file road_map.h.
Which directions are disallowed ?
Definition at line 255 of file road_map.h.
enum Roadside |
The possible road side decorations.
Definition at line 447 of file road_map.h.
enum 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 23 of file road_map.h.
|
inlinestatic |
Bar a level crossing.
t | The tile to change. |
Definition at line 417 of file road_map.h.
References SetCrossingBarred().
Referenced by MaybeBarCrossingWithSound().
Get all set RoadBits on the given tile.
tile | The tile from which we want to get the RoadBits |
Definition at line 139 of file road_map.h.
References GetRoadBits(), ROADTYPE_ROAD, and ROADTYPE_TRAM.
Returns the RoadBits on an arbitrary tile Special behaviour:
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.
tile | the tile to get the road bits for |
rt | the road type to get the road bits form |
straight_tunnel_bridge_entrance | whether to return straight road bits for tunnels/bridges. |
Definition at line 35 of file road_map.cpp.
References AxisToRoadBits(), DIAGDIR_NE, DiagDirToAxis(), DiagDirToRoadBits(), GetCrossingRoadBits(), GetRoadBits(), GetRoadDepotDirection(), GetRoadStopDir(), GetRoadTileType(), GetTileType(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), HasTileRoadType(), IsDriveThroughStopTile(), IsRoadStopTile(), 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 CanConnectToRoad(), CanRemoveRoadWithStop(), CleanUpRoadBits(), and GetTownRoadBits().
Get the rail axis of a level crossing.
t | The tile to query. |
Definition at line 307 of file road_map.h.
Referenced by GetCrossingRailBits(), and GetCrossingRailTrack().
Get the rail track bits of a level crossing.
tile | The tile to query. |
Definition at line 338 of file road_map.h.
References AxisToTrackBits(), and GetCrossingRailAxis().
Referenced by GetCrossingReservationTrackBits(), and GetRailTrackBitsUniversal().
Get the rail track of a level crossing.
tile | The tile to query. |
Definition at line 328 of file road_map.h.
References AxisToTrack(), and GetCrossingRailAxis().
Referenced by CmdConvertRail().
Get the reserved track bits for a rail crossing.
t | the tile |
Definition at line 375 of file road_map.h.
References GetCrossingRailBits(), HasCrossingReservation(), and TRACK_BIT_NONE.
Referenced by GetReservedTrackbits().
Get the road axis of a level crossing.
t | The tile to query. |
Definition at line 295 of file road_map.h.
Referenced by CanEnterTileOwnerCheck(), and GetCrossingRoadBits().
Get the road bits of a level crossing.
tile | The tile to query. |
Definition at line 318 of file road_map.h.
References AXIS_X, GetCrossingRoadAxis(), ROAD_X, and ROAD_Y.
Referenced by GetAnyRoadBits().
|
inlinestatic |
Gets the disallowed directions.
t | the tile to get the directions from |
Definition at line 271 of file road_map.h.
Get all RoadBits set on a tile except from the given RoadType.
t | The tile from which we want to get the RoadBits |
rt | The RoadType which we exclude from the querry |
Definition at line 128 of file road_map.h.
References GetRoadBits(), ROADTYPE_ROAD, and ROADTYPE_TRAM.
Get the present road bits for a specific road type.
t | The tile to query. |
rt | Road type. |
Definition at line 111 of file road_map.h.
Referenced by ConnectRoadToStructure(), DrawRoadBits(), GetAllRoadBits(), GetAnyRoadBits(), GetOtherRoadBits(), and GetSingleTramBit().
|
inlinestatic |
Get the direction of the exit of a road depot.
t | The tile to query. |
Definition at line 534 of file road_map.h.
Referenced by CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanExitOldTile(), CmdBuildRoadVehicle(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::ForcedReverse(), GetAnyRoadBits(), RoadVehicle::GetVehicleTrackdir(), CYapfCostRoadT< Types >::PfCalcCost(), and RoadFindPathToDest().
Get the owner of a specific road type.
t | The tile to query. |
rt | The road type to get the owner of. |
Definition at line 199 of file road_map.h.
Referenced by CanRemoveRoadWithStop(), and RemoveRoad().
Get the decorations of a road.
tile | The tile to query. |
Definition at line 462 of file road_map.h.
Referenced by HasRoadWorks().
|
inlinestatic |
Get the type of the road tile.
t | Tile to query. |
Definition at line 35 of file road_map.h.
Referenced by DrawTile_Road(), GetAnyRoadBits(), IsLevelCrossing(), IsNormalRoad(), and IsRoadDepot().
Get the present road types of a tile.
t | The tile to query. |
Definition at line 166 of file road_map.h.
Referenced by CanRemoveRoadWithStop(), RoadStop::GetNextRoadStop(), HasTileRoadType(), BaseStation::PostDestructor(), RemoveRoad(), and RoadFindPathToDest().
|
inlinestatic |
Get the reservation state of the rail crossing.
t | the crossing tile |
Definition at line 350 of file road_map.h.
Referenced by GetCrossingReservationTrackBits().
|
inlinestatic |
Check if a tile has road works.
t | The tile to check. |
Definition at line 482 of file road_map.h.
References GetRoadside(), and ROADSIDE_GRASS_ROAD_WORKS.
Check if a tile has a specific road type.
t | The tile to check. |
rt | Road type to check. |
Definition at line 188 of file road_map.h.
References GetRoadTypes(), and HasBit().
Referenced by CmdBuildRoadVehicle(), GetAnyRoadBits(), and HasTownOwnedRoad().
|
inlinestatic |
Checks if given tile has town owned road.
t | tile to check |
Definition at line 249 of file road_map.h.
References HasTileRoadType(), IsRoadOwner(), OWNER_TOWN, and ROADTYPE_ROAD.
Referenced by ClosestTownFromTile().
|
inlinestatic |
Increase the progress counter of road works.
t | The tile to modify. |
Definition at line 492 of file road_map.h.
|
inlinestatic |
Check if the level crossing is barred.
t | The tile to query. |
Definition at line 386 of file road_map.h.
Referenced by MaybeBarCrossingWithSound().
|
inlinestatic |
Return whether a tile is a level crossing.
t | Tile to query. |
Definition at line 68 of file road_map.h.
References GetRoadTileType(), and ROAD_TILE_CROSSING.
Referenced by CanEnterTileOwnerCheck(), CmdConvertRail(), GetRailTrackBitsUniversal(), GetReservedTrackbits(), GetTileRailType(), IsLevelCrossingTile(), CYapfCostRoadT< Types >::OneTileCost(), and CYapfCostRailT< Types >::OneTileCost().
|
inlinestatic |
Return whether a tile is a level crossing tile.
t | Tile to query. |
Definition at line 78 of file road_map.h.
References IsLevelCrossing(), IsTileType(), and MP_ROAD.
Referenced by CmdConvertRail().
|
inlinestatic |
Return whether a tile is a normal road.
t | Tile to query. |
Definition at line 47 of file road_map.h.
References GetRoadTileType(), and ROAD_TILE_NORMAL.
Referenced by IsNormalRoadTile().
|
inlinestatic |
Return whether a tile is a normal road tile.
t | Tile to query. |
Definition at line 57 of file road_map.h.
References IsNormalRoad(), IsTileType(), and MP_ROAD.
Referenced by CleanUpRoadBits(), ConnectRoadToStructure(), and GetSingleTramBit().
|
inlinestatic |
Check if a road tile has snow/desert.
t | The tile to query. |
Definition at line 429 of file road_map.h.
Referenced by DrawRoadAsSnowDesert().
|
inlinestatic |
Return whether a tile is a road depot.
t | Tile to query. |
Definition at line 89 of file road_map.h.
References GetRoadTileType(), and ROAD_TILE_DEPOT.
Referenced by ClosestTownFromTile(), IsRoadDepotTile(), and RoadFindPathToDest().
|
inlinestatic |
Return whether a tile is a road depot tile.
t | Tile to query. |
Definition at line 99 of file road_map.h.
References IsRoadDepot(), IsTileType(), and MP_ROAD.
Referenced by CanEnterTileOwnerCheck(), GetTownRoadBits(), IsDepotTile(), CYapfCostRoadT< Types >::PfCalcCost(), and CYapfDestinationAnyDepotRoadT< Types >::PfDetectDestination().
Check if a specific road type is owned by an owner.
t | The tile to query. |
rt | The road type to compare the owner of. |
o | Owner to compare with. |
Definition at line 237 of file road_map.h.
Referenced by HasTownOwnedRoad().
|
inlinestatic |
Make a level crossing.
t | Tile to make a level crossing. |
road | New owner of road. |
tram | New owner of tram tracks. |
rail | New owner of the rail track. |
roaddir | Axis of the road. |
rat | New rail type. |
rot | New present road types. |
town | Town ID if the road is a town-owned road. |
Definition at line 577 of file road_map.h.
References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_ROAD, ROAD_TILE_CROSSING, ROADTYPE_TRAM, SB(), SetRoadOwner(), SetTileOwner(), and SetTileType().
|
inlinestatic |
Make a road depot.
t | Tile to make a level crossing. |
owner | New owner of the depot. |
did | New depot ID. |
dir | Direction of the depot exit. |
rt | Road type of the depot. |
Definition at line 598 of file road_map.h.
References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_ROAD, Window::owner, ROAD_TILE_DEPOT, ROADTYPE_TRAM, RoadTypeToRoadTypes(), SB(), SetRoadOwner(), SetTileOwner(), and SetTileType().
Referenced by CmdBuildRoadDepot().
|
inlinestatic |
Make a normal road tile.
t | Tile to make a normal road. |
bits | Road bits to set for all present road types. |
rot | New present road types. |
town | Town ID if the road is a town-owned road. |
road | New owner of road. |
tram | New owner of tram tracks. |
Definition at line 553 of file road_map.h.
References _m, _me, HasBit(), Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_ROAD, ROAD_TILE_NORMAL, ROADTYPE_ROAD, ROADTYPE_TRAM, SB(), SetRoadOwner(), SetTileOwner(), and SetTileType().
|
inlinestatic |
Set the bar state of a level crossing.
t | The tile to modify. |
barred | True if the crossing should be barred, false otherwise. |
Definition at line 398 of file road_map.h.
Referenced by BarCrossing(), and UnbarCrossing().
|
inlinestatic |
Set the reservation state of the rail crossing.
t | the crossing tile |
b | the reservation state |
Definition at line 363 of file road_map.h.
|
inlinestatic |
Sets the disallowed directions.
t | the tile to set the directions for |
drd | the disallowed directions |
Definition at line 282 of file road_map.h.
Set the present road bits for a specific road type.
t | The tile to change. |
r | The new road bits. |
rt | Road type. |
Definition at line 151 of file road_map.h.
Set the owner of a specific road type.
t | The tile to change. |
rt | The road type to change the owner of. |
o | New owner of the given road type. |
Definition at line 220 of file road_map.h.
Referenced by MakeRoadBridgeRamp(), MakeRoadCrossing(), MakeRoadDepot(), MakeRoadNormal(), and MakeRoadTunnel().
Set the decorations of a road.
tile | The tile to change. |
s | The new road decoration of the tile. |
Definition at line 472 of file road_map.h.
Set the present road types of a tile.
t | The tile to change. |
rt | The new road types. |
Definition at line 176 of file road_map.h.
Referenced by MakeRoadBridgeRamp(), and MakeRoadTunnel().
|
inlinestatic |
Start road works on a tile.
t | The tile to start the work on. |
Definition at line 504 of file road_map.h.
|
inlinestatic |
Terminate road works on a tile.
t | Tile to stop the road works on. |
Definition at line 520 of file road_map.h.
|
inlinestatic |
Toggle the snow/desert state of a road tile.
t | The tile to change. |
Definition at line 440 of file road_map.h.
References _me, and ToggleBit().
|
inlinestatic |
Unbar a level crossing.
t | The tile to change. |
Definition at line 408 of file road_map.h.
References SetCrossingBarred().