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 TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
Helper template class that makes basic properties of given enumeration type visible from outsize...
Owner
Enum for all companies/owners.
static bool HasTileAnyRoadType(TileIndex t, RoadTypes rts)
Check if a tile has one of the specified road types.
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
uint16 DepotID
Type for the unique identifier of depots.
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 void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
static void StartRoadWorks(TileIndex t)
Start road works on a tile.
Functions related to roads.
static RoadBits GetAllRoadBits(TileIndex tile)
Get all set RoadBits on the given tile.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
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 T ToggleBit(T &x, const uint8 y)
Toggles a bit in a variable.
static bool HasCrossingReservation(TileIndex t)
Get the reservation state of the rail crossing.
byte m7
Primarily used for newgrf support.
static bool HasTileRoadType(TileIndex t, RoadTramType rtt)
Check if a tile has a road or a tram road type.
uint16 m2
Primarily used for indices to towns, industries and stations.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
static TrackBits GetCrossingRailBits(TileIndex tile)
Get the rail track bits of a level crossing.
A tile with road (or tram tracks)
static TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
Full road along the x-axis (south-west + north-east)
A town owns the tile, or a town is expanding.
Tile * _m
Tiles of the map.
static void MakeRoadDepot(TileIndex t, Owner owner, DepotID did, DiagDirection dir, RoadType rt)
Make a road depot.
flag for invalid roadtype
static Roadside GetRoadside(TileIndex tile)
Get the decorations of a road.
RoadBits GetAnyRoadBits(TileIndex tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance=false)
Returns the RoadBits on an arbitrary tile Special behaviour:
static bool IsRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
Check if a specific road type is owned by an owner.
static void TerminateRoadWorks(TileIndex t)
Terminate road works on a tile.
static DiagDirection GetRoadDepotDirection(TileIndex t)
Get the direction of the exit of a road depot.
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...
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
static void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
Sets the disallowed directions.
RoadType
The different roadtypes we support.
static RoadTypes GetPresentRoadTypes(TileIndex t)
Get the present road types of a tile.
static void SetRoadTypes(TileIndex t, RoadType road_rt, RoadType tram_rt)
Set the present road types of a tile.
Road with paved sidewalks.
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.
Roadside
The possible road side decorations.
static bool HasRoadWorks(TileIndex t)
Check if a tile has road works.
static void SetCrossingBarred(TileIndex t, bool barred)
Set the bar state of a level crossing.
static bool IsOnSnow(TileIndex t)
Check if a road tile has snow/desert.
static void SetCrossingReservation(TileIndex t, bool b)
Set the reservation state of the rail crossing.
Header files for depots (not hangars)
None of the directions are disallowed.
The tile has no ownership.
All northbound traffic is disallowed.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
static TrackBits GetCrossingReservationTrackBits(TileIndex t)
Get the reserved track bits for a rail crossing.
static RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
Get the present road bits for a specific road type.
Road with trees on paved sidewalks.
RoadTileType
The different types of road tiles.
static bool HasTownOwnedRoad(TileIndex t)
Checks if given tile has town owned road.
Informative template class exposing basic enumeration properties used by several other templates belo...
TileExtended * _me
Extended Tiles of the map.
RoadBits
Enumeration for the road parts on a tile.
static bool IsRoadDepotTile(TileIndex t)
Return whether a tile is a road depot tile.
static Axis GetCrossingRailAxis(TileIndex t)
Get the rail axis of a level crossing.
static Axis GetCrossingRoadAxis(TileIndex t)
Get the road axis of a level crossing.
Road with street lights on paved sidewalks.
TrackBits
Bitfield corresponding to Track.
static void ToggleSnow(TileIndex t)
Toggle the snow/desert state of a road tile.
static bool MayHaveRoad(TileIndex t)
Test whether a tile can have road/tram types.
static void SetRoadTypeRoad(TileIndex t, RoadType rt)
Set the road road type of a tile.
All directions are disallowed.
static void BarCrossing(TileIndex t)
Bar a level crossing.
static void SetRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
Set the owner of a specific road type.
static void SetRoadside(TileIndex tile, Roadside s)
Set the decorations of a road.
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 Owner GetRoadOwner(TileIndex t, RoadTramType rtt)
Get the owner of a specific road type.
static bool IsNormalRoadTile(TileIndex t)
Return whether a tile is a normal road tile.
RailType
Enumeration for all possible railtypes.
static RoadTileType GetRoadTileType(TileIndex t)
Get the type of the road tile.
Tunnel entry/exit and bridge heads.
Road with sidewalks and road works.
uint32 TileIndex
The index/ID of a Tile.
static bool IsLevelCrossingTile(TileIndex t)
Return whether a tile is a level crossing tile.
Track
These are used to specify a single track.
static bool IncreaseRoadWorksCounter(TileIndex t)
Increase the progress counter of road works.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
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 void UnbarCrossing(TileIndex t)
Unbar a level crossing.
uint16 m8
General purpose.
Road on grass with road works.
static Axis OtherAxis(Axis a)
Select the other axis as provided.
DisallowedRoadDirections
Which directions are disallowed ?
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable...
static DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
Gets the disallowed directions.
static bool IsNormalRoad(TileIndex t)
Return whether a tile is a normal road.
static void SetRoadType(TileIndex t, RoadTramType rtt, RoadType rt)
Set the road type of a tile.
All southbound traffic is disallowed.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
DiagDirection
Enumeration for diagonal directions.
static bool IsCrossingBarred(TileIndex t)
Check if the level crossing is barred.
Full road along the y-axis (north-west + south-east)
static Track GetCrossingRailTrack(TileIndex tile)
Get the rail track of a level crossing.
Map writing/reading functions for tiles.
Different conversion functions from one kind of track to another.
static void MakeRoadNormal(TileIndex t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
Make a normal road tile.
Axis
Allow incrementing of DiagDirDiff variables.
static bool IsRoadDepot(TileIndex t)
Return whether a tile is a road depot.
The different types of rail.