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