|
OpenTTD Source
14.0-beta1
|
Go to the documentation of this file.
156 if (rtt == RTT_TRAM) {
177 return (rtt == RTT_TRAM) ? GetRoadTypeTram(t) : GetRoadTypeRoad(t);
195 inline bool HasRoadTypeRoad(
Tile t)
200 inline bool HasRoadTypeTram(
Tile t)
253 if (rtt == RTT_ROAD) {
316 SB(t.
m5(), 4, 2, drd);
396 SB(t.
m5(), 4, 1, b ? 1 : 0);
431 SB(t.
m5(), 5, 1, barred ? 1 : 0);
453 #define IsOnDesert IsOnSnow
465 #define ToggleDesert ToggleSnow
505 SB(tile.
m6(), 3, 3, s);
527 return GB(t.
m7(), 0, 4) == 15;
583 SB(t.
m4(), 0, 6, rt);
595 SB(t.
m8(), 6, 6, rt);
606 if (rtt == RTT_TRAM) {
683 SB(tile.
m5(), 0, 2, dir);
698 tile.
m2() = depot_id;
702 SB(tile.
m6(), 2, 4, 0);
void StartRoadWorks(Tile t)
Start road works on a tile.
@ TRACK_BIT_NONE
No track.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
DisallowedRoadDirections GetDisallowedRoadDirections(Tile t)
Gets the disallowed directions.
void SetRoadTypes(Tile t, RoadType road_rt, RoadType tram_rt)
Set the present road types of a tile.
Track GetCrossingRailTrack(Tile tile)
Get the rail track of a level crossing.
void TerminateRoadWorks(Tile t)
Terminate road works on a tile.
bool IsRoadOwner(Tile t, RoadTramType rtt, Owner o)
Check if a specific road type is owned by an owner.
@ ROAD_TILE_CROSSING
Level crossing.
Axis
Allow incrementing of DiagDirDiff variables.
Roadside GetRoadside(Tile tile)
Get the decorations of a road.
void SetRoadType(Tile t, RoadTramType rtt, RoadType rt)
Set the road type of a tile.
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
TrackBits GetCrossingRailBits(Tile tile)
Get the rail track bits of a level crossing.
debug_inline uint16_t & m8()
General purpose.
void SetRoadDepotExitDirection(Tile tile, DiagDirection dir)
Sets the exit direction of a road depot.
RoadTileType
The different types of road tiles.
debug_inline byte & m6()
General purpose.
void SetRoadTypeRoad(Tile t, RoadType rt)
Set the road road type of a tile.
@ ROADSIDE_BARREN
Road on barren land.
Wrapper class to abstract away the way the tiles are stored.
static debug_inline bool IsNormalRoad(Tile t)
Return whether a tile is a normal road.
bool IsLevelCrossingTile(Tile t)
Return whether a tile is a level crossing tile.
bool HasTownOwnedRoad(Tile t)
Checks if given tile has town owned road.
bool IsLevelCrossing(Tile t)
Return whether a tile is a level crossing.
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
debug_inline byte & m5()
General purpose.
Owner
Enum for all companies/owners.
RoadBits GetAnyRoadBits(Tile tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance=false)
Returns the RoadBits on an arbitrary tile Special behaviour:
debug_inline byte & m1()
Primarily used for ownership information.
debug_inline byte & m4()
General purpose.
@ MP_ROAD
A tile with road (or tram tracks)
@ INVALID_ROADTYPE
flag for invalid roadtype
void SetRoadTypeTram(Tile t, RoadType rt)
Set the tram road type of a tile.
RoadBits GetCrossingRoadBits(Tile tile)
Get the road bits of a level crossing.
void SetCrossingReservation(Tile t, bool b)
Set the reservation state of the rail crossing.
static debug_inline TileType GetTileType(Tile tile)
Get the tiletype of a given tile.
@ ROAD_X
Full road along the x-axis (south-west + north-east)
DiagDirection GetRoadDepotDirection(Tile t)
Get the direction of the exit of a road depot.
Roadside
The possible road side decorations.
@ ROAD_TILE_NORMAL
Normal road.
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
@ ROADSIDE_STREET_LIGHTS
Road with street lights on paved sidewalks.
@ ROADTYPES_NONE
No roadtypes.
debug_inline byte & m7()
Primarily used for newgrf support.
void ToggleSnow(Tile t)
Toggle the snow/desert state of a road tile.
@ ROADSIDE_GRASS
Road on grass.
RailType
Enumeration for all possible railtypes.
debug_inline uint16_t & m2()
Primarily used for indices to towns, industries and stations.
void BarCrossing(Tile t)
Bar a level crossing.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
bool MayHaveRoad(Tile t)
Test whether a tile can have road/tram types.
void SetRoadside(Tile tile, Roadside s)
Set the decorations of a road.
@ ROADSIDE_PAVED
Road with paved sidewalks.
constexpr T AB(T &x, const uint8_t s, const uint8_t n, const U i)
Add i to n bits of x starting at bit s.
DisallowedRoadDirections
Which directions are disallowed ?
static debug_inline bool IsNormalRoadTile(Tile t)
Return whether a tile is a normal road tile.
bool HasTileRoadType(Tile t, RoadTramType rtt)
Check if a tile has a road or a tram road type.
bool IsCrossingBarred(Tile t)
Check if the level crossing is barred.
static debug_inline RoadTileType GetRoadTileType(Tile t)
Get the type of the road tile.
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
bool HasRoadWorks(Tile t)
Check if a tile has road works.
DiagDirection
Enumeration for diagonal directions.
@ ROADSIDE_TREES
Road with trees on paved sidewalks.
void SetTileOwner(Tile tile, Owner owner)
Sets the owner of a tile.
uint16_t DepotID
Type for the unique identifier of depots.
void SetDisallowedRoadDirections(Tile t, DisallowedRoadDirections drd)
Sets the disallowed directions.
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.
Axis GetCrossingRoadAxis(Tile t)
Get the road axis of a level crossing.
void SetCrossingBarred(Tile t, bool barred)
Set the bar state of a level crossing.
bool IsValidDisallowedRoadDirections(DisallowedRoadDirections drt)
Checks if a DisallowedRoadDirections is valid.
@ ROAD_TILE_DEPOT
Depot (one entrance)
@ OWNER_NONE
The tile has no ownership.
void SetRoadBits(Tile t, RoadBits r, RoadTramType rtt)
Set the present road bits for a specific road type.
Owner GetRoadOwner(Tile t, RoadTramType rtt)
Get the owner of a specific road type.
@ MP_STATION
A tile of a station.
void SetTileType(Tile tile, TileType type)
Set the type of a tile.
RoadType
The different roadtypes we support.
RoadBits GetRoadBits(Tile t, RoadTramType rtt)
Get the present road bits for a specific road type.
bool IncreaseRoadWorksCounter(Tile t)
Increase the progress counter of road works.
bool HasCrossingReservation(Tile t)
Get the reservation state of the rail crossing.
void SetRoadOwner(Tile t, RoadTramType rtt, Owner o)
Set the owner of a specific road type.
RoadBits
Enumeration for the road parts on a tile.
Track AxisToTrack(Axis a)
Convert an Axis to the corresponding Track AXIS_X -> TRACK_X AXIS_Y -> TRACK_Y Uses the fact that the...
TrackBits GetCrossingReservationTrackBits(Tile t)
Get the reserved track bits for a rail crossing.
TrackBits
Allow incrementing of Track variables.
void MakeRoadDepot(Tile tile, Owner owner, DepotID depot_id, DiagDirection dir, RoadType rt)
Make a road depot.
void MakeRoadNormal(Tile t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
Make a normal road tile.
void UnbarCrossing(Tile t)
Unbar a level crossing.
Axis GetCrossingRailAxis(Tile t)
Get the rail axis of a level crossing.
TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
RoadBits GetAllRoadBits(Tile tile)
Get all set RoadBits on the given tile.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
@ ROADSIDE_PAVED_ROAD_WORKS
Road with sidewalks and road works.
Track
These are used to specify a single track.
bool HasTileAnyRoadType(Tile t, RoadTypes rts)
Check if a tile has one of the specified road types.
debug_inline byte & m3()
General purpose.
Axis OtherAxis(Axis a)
Select the other axis as provided.
static debug_inline bool IsRoadDepot(Tile t)
Return whether a tile is a road depot.
constexpr T ToggleBit(T &x, const uint8_t y)
Toggles a bit in a variable.
@ OWNER_TOWN
A town owns the tile, or a town is expanding.
@ ROADSIDE_GRASS_ROAD_WORKS
Road on grass with road works.
bool IsOnSnow(Tile t)
Check if a road tile has snow/desert.
static debug_inline bool IsRoadDepotTile(Tile t)
Return whether a tile is a road depot tile.
RoadTypes GetPresentRoadTypes(Tile t)
Get the present road types of a tile.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.