Go to the documentation of this file.
44 #include "table/strings.h"
53 std::vector<RoadType> _sorted_roadtypes;
75 { 0, 0, 0, 0, 0, 0, 0, 0, 0, {}, {}, 0, {}, {} },
79 for (; i <
lengthof(_roadtypes); i++) _roadtypes[i] = empty_roadtype;
88 if (cursors_base != 0) {
112 if (RoadTypeIsRoad(first) == RoadTypeIsRoad(second)) {
115 return RoadTypeIsTram(first) < RoadTypeIsTram(second);
125 ResolveRoadTypeGUISprites(rti);
129 _sorted_roadtypes.clear();
131 if (_roadtypes[rt].label != 0 && !
HasBit(_roadtypes_hidden_mask, rt)) {
132 _sorted_roadtypes.push_back(rt);
135 std::sort(_sorted_roadtypes.begin(), _sorted_roadtypes.end(),
CompareRoadTypes);
146 if (rti->
label == 0) {
169 if (rtt == RTT_TRAM) {
202 if (c ==
nullptr)
return;
297 if (ret.
Failed())
return ret;
344 if (ret.
Failed())
return ret;
352 if (ret.
Failed())
return ret;
359 if (ret.
Failed())
return ret;
368 if (ret.
Failed())
return ret;
444 if (pieces ==
ROAD_NONE)
return_cmd_error((rtt == RTT_TRAM) ? STR_ERROR_THERE_IS_NO_TRAMWAY : STR_ERROR_THERE_IS_NO_ROAD);
569 RoadBits type_bits = existing | *pieces;
582 type_bits = existing | *pieces;
630 town_id = (town !=
nullptr) ? town->
index : INVALID_TOWN;
647 RoadTramType rtt = GetRoadTramType(rt);
649 bool need_to_clear =
false;
656 other_bits =
GetRoadBits(tile, OtherRoadTramType(rtt));
665 if ((existing & pieces) == pieces) {
667 if (toggle_drd !=
DRD_NONE && rtt == RTT_ROAD) {
673 if (ret.
Failed())
return ret;
685 if (ret.
Failed())
return ret;
703 if (ret.
Failed())
return ret;
725 default: NOT_REACHED();
752 if (pieces &
ROAD_X)
goto do_clear;
757 if (pieces &
ROAD_Y)
goto do_clear;
761 default:
goto do_clear;
765 if (ret.
Failed())
return ret;
797 if (pieces & ~curbits)
goto do_clear;
811 if (ret.
Failed())
return ret;
817 need_to_clear =
true;
824 if (ret.
Failed())
return ret;
828 if (other_bits != pieces) {
839 if (!need_to_clear) {
858 if (ret.
Failed())
return ret;
864 RoadType existing_rt = GetRoadType(tile, rtt);
870 if (ret.
Failed())
return ret;
957 RoadTramType rtt = GetRoadTramType(rt);
958 RoadType existing = GetRoadType(tile, rtt);
994 if (start_tile > end_tile || (start_tile == end_tile && start_half)) {
996 start_half = !start_half;
997 end_half = !end_half;
1009 bool had_bridge =
false;
1010 bool had_tunnel =
false;
1011 bool had_success =
false;
1018 if (!is_ai && start_tile != end_tile) {
1035 if (is_ai)
return last_error;
1058 if (tile == end_tile)
break;
1063 return had_success ? cost : last_error;
1089 if (start_tile > end_tile || (start_tile == end_tile && start_half)) {
1090 std::swap(start_tile, end_tile);
1091 std::swap(start_half, end_half);
1095 Money money_spent = 0;
1098 bool had_success =
false;
1108 RoadTramType rtt = GetRoadTramType(rt);
1113 if (money_spent > 0 && money_spent > money_available) {
1116 RemoveRoad(tile, flags, bits, rtt,
true,
false);
1123 case STR_ERROR_OWNED_BY:
1124 case STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS:
1132 if (tile == end_tile)
break;
1137 return { had_success ? cost : last_error, 0 };
1162 cost.
AddCost(_price[PR_BUILD_FOUNDATION]);
1166 if (cost.
Failed())
return cost;
1183 cost.
AddCost(_price[PR_BUILD_DEPOT_ROAD]);
1191 if (ret.
Failed())
return ret;
1195 if (ret.
Failed())
return ret;
1201 RoadType rt = GetRoadTypeRoad(tile);
1207 delete Depot::GetByTile(tile);
1208 DoClearSquare(tile);
1223 for (RoadTramType rtt : _roadtramtypes) {
1227 if (tmp_ret.
Failed())
return tmp_ret;
1242 for (RoadTramType rtt : { RTT_TRAM, RTT_ROAD }) {
1246 if (tmp_ret.
Failed())
return tmp_ret;
1261 return RemoveRoadDepot(tile, flags);
1303 const byte _road_sloped_sprites[14] = {
1324 default: NOT_REACHED();
1327 static const uint offsets[] = {
1333 return offsets[bits];
1376 RoadType rt_road = GetRoadTypeRoad(neighbour);
1377 RoadType rt_tram = GetRoadTypeTram(neighbour);
1386 if (
CountBits(rb_new) >= 2) rb = rb_new;
1393 if (front != 0 || back != 0) {
1397 back = SPR_TRAMWAY_BACK_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1398 front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1413 static const int INF = 1000;
1414 static const SubSprite west = { -INF, -INF, -12, INF };
1415 static const SubSprite north = { -12, -INF, 12, INF };
1416 static const SubSprite east = { 12, -INF, INF, INF };
1417 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 16, 1, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 15, 0,
GetSlopePixelZInCorner(ti->
tileh, CORNER_W), &west);
1418 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 1, 1, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 0,
GetSlopePixelZInCorner(ti->
tileh, CORNER_N), &north);
1419 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 1, 16, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 15,
GetSlopePixelZInCorner(ti->
tileh, CORNER_E), &east);
1423 AddSortableSpriteToDraw(front, pal, ti->
x, ti->
y, 16, 16, z_wires + 1, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 0, z_wires);
1462 rt = GetRoadTypeTram(ti->
tile);
1497 if (draw_underlay) {
1499 if (road_rti !=
nullptr) {
1500 if (road_rti->UsesOverlay()) {
1505 if (tram_rti->UsesOverlay()) {
1515 if (road_rti !=
nullptr) {
1516 if (road_rti->UsesOverlay()) {
1523 if (tram_rti !=
nullptr) {
1524 if (tram_rti->UsesOverlay()) {
1527 }
else if (road_rti !=
nullptr) {
1544 if (rti ==
nullptr || rti->UsesOverlay()) {
1559 SpriteID image = SPR_ROAD_Y + offset;
1567 default: image -= 19;
break;
1607 if (road_rti !=
nullptr) {
1615 oneway += SPR_ONEWAY_SLOPE_N_OFFSET;
1617 oneway += SPR_ONEWAY_SLOPE_S_OFFSET;
1643 if (height < minz)
return;
1653 for (
const DrawRoadTileStruct *drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
1654 DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10, is_transparent);
1681 if (rti->UsesOverlay()) {
1682 SpriteID image = SPR_ROAD_Y + axis;
1691 default: image -= 19;
break;
1707 default: image += 4;
break;
1718 if (rti->UsesOverlay()) {
1726 uint adjacent_diagdirs = 0;
1730 SetBit(adjacent_diagdirs, dir);
1734 switch (adjacent_diagdirs) {
1759 }
else if (draw_pbs || tram_rti !=
nullptr || road_rti->UsesOverlay()) {
1786 bool default_gfx = relocation == 0;
1791 relocation = SPR_TRAMWAY_DEPOT_WITH_TRACK - SPR_ROAD_DEPOT;
1792 default_gfx =
false;
1795 relocation = SPR_TRAMWAY_DEPOT_NO_TRACK - SPR_ROAD_DEPOT;
1799 relocation -= SPR_ROAD_DEPOT;
1808 if (rti->UsesOverlay()) {
1836 bool default_gfx = relocation == 0;
1841 relocation = SPR_TRAMWAY_DEPOT_WITH_TRACK - SPR_ROAD_DEPOT;
1842 default_gfx =
false;
1845 relocation = SPR_TRAMWAY_DEPOT_NO_TRACK - SPR_ROAD_DEPOT;
1849 relocation -= SPR_ROAD_DEPOT;
1857 if (rti->UsesOverlay()) {
1859 if (ground != 0)
DrawSprite(ground + offset, PAL_NONE, x, y);
1860 }
else if (RoadTypeIsTram(rt)) {
1861 DrawSprite(SPR_TRAMWAY_OVERLAY + offset, PAL_NONE, x, y);
1879 TownID tid = INVALID_TOWN;
1882 if (town !=
nullptr) tid = town->
index;
1889 static int GetSlopePixelZ_Road(
TileIndex tile, uint x, uint y)
1914 static const Roadside _town_road_types[][2] = {
1922 static const Roadside _town_road_types_2[][2] = {
1931 static void TileLoop_Road(
TileIndex tile)
1953 HouseZonesBits grp = HZB_TOWN_EDGE;
1983 if (cur_rs == new_rs[0])
return;
1986 if (cur_rs == new_rs[1]) {
2006 if (old_rb != new_rb) {
2020 if (rt != GetRoadTypeRoad(tile)) {
2029 static bool ClickTile_Road(
TileIndex tile)
2038 static const TrackBits _road_trackbits[16] = {
2067 RoadTramType rtt = (RoadTramType)sub_mode;
2071 const uint drd_to_multiplier[
DRD_END] = { 0x101, 0x100, 0x1, 0x0 };
2089 red_signals = trackdirbits;
2121 static const StringID _road_tile_strings[] = {
2122 STR_LAI_ROAD_DESCRIPTION_ROAD,
2123 STR_LAI_ROAD_DESCRIPTION_ROAD,
2124 STR_LAI_ROAD_DESCRIPTION_ROAD,
2125 STR_LAI_ROAD_DESCRIPTION_ROAD_WITH_STREETLIGHTS,
2126 STR_LAI_ROAD_DESCRIPTION_ROAD,
2127 STR_LAI_ROAD_DESCRIPTION_TREE_LINED_ROAD,
2128 STR_LAI_ROAD_DESCRIPTION_ROAD,
2129 STR_LAI_ROAD_DESCRIPTION_ROAD,
2138 RoadType road_rt = GetRoadTypeRoad(tile);
2139 RoadType tram_rt = GetRoadTypeTram(tile);
2155 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING;
2166 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_VEHICLE_DEPOT;
2182 bool mixed_owners = (tram_owner !=
INVALID_OWNER && tram_owner != first_owner) || (rail_owner !=
INVALID_OWNER && rail_owner != first_owner);
2187 td->
owner[0] = rail_owner;
2189 td->
owner[1] = road_owner;
2191 td->
owner[2] = tram_owner;
2194 td->
owner[0] = first_owner;
2213 if (rv->frame == RVC_DEPOT_STOP_FRAME &&
2241 RoadType rt = GetRoadTypeRoad(tile);
2247 for (RoadTramType rtt : _roadtramtypes) {
2257 for (RoadTramType rtt : _roadtramtypes) {
2260 RoadType rt = GetRoadType(tile, rtt);
2264 Company::Get(old_owner)->infrastructure.road[rt] -= num_bits;
2305 if (bits == bits_copy) {
2320 default: NOT_REACHED();
2400 RoadTramType rtt = GetRoadTramType(to_type);
2404 bool found_convertible_road =
false;
2412 RoadType from_type = GetRoadType(tile, rtt);
2423 error.MakeError(STR_ERROR_CROSSING_DISALLOWED_ROAD);
2464 if (rtt == RTT_ROAD && owner ==
OWNER_TOWN) {
2465 error.MakeError(STR_ERROR_OWNED_BY);
2478 found_convertible_road =
true;
2505 if (endtile < tile) {
2517 if (rtt == RTT_ROAD && owner ==
OWNER_TOWN) {
2518 error.MakeError(STR_ERROR_OWNED_BY);
2526 found_convertible_road =
true;
2563 return found_convertible_road ? cost :
error;
2570 GetSlopePixelZ_Road,
2574 GetTileTrackStatus_Road,
2578 ChangeTileOwner_Road,
static void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence in GUI with railroad specifics.
RoadTypeFlags flags
Bit mask of road type flags.
@ EV_BULLDOZER
Bulldozer at roadworks.
static void DrawRoadBits(TileInfo *ti)
Draw ground sprite and road pieces.
Buses, trucks and trams belong to this class.
static bool RailNoLevelCrossings(RailType rt)
Test if a RailType disallows build of level crossings.
@ ROTSG_ONEWAY
Optional: One-way indicator images.
static bool HasTownOwnedRoad(TileIndex t)
Checks if given tile has town owned road.
@ SLOPE_SE
south and east corner are raised
static DiagDirection GetRoadDepotDirection(TileIndex t)
Get the direction of the exit of a road depot.
@ TROPICZONE_DESERT
Tile is desert.
@ ROTSG_GROUND
Required: Main group of ground images.
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
SpriteID single_x
single piece of rail in X direction, without ground
@ TRACK_BIT_NONE
No track.
@ ROADTYPE_END
Used for iterations.
Cheat magic_bulldozer
dynamite industries, objects
uint16 max_speed
Maximum speed for vehicles travelling on this rail type.
static bool Chance16(const uint a, const uint b)
Flips a coin with given probability.
static bool IsValidAxis(Axis d)
Checks if an integer value is a valid Axis.
static Titem * Get(size_t index)
Returns Titem with given index.
static const RoadTypeInfo _original_roadtypes[]
Global Roadtype definition.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
static bool IsRoadStop(TileIndex t)
Is the station at t a road station?
static bool HasAtMostOneBit(T value)
Test whether value has at most 1 bit set.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
@ ROTF_CATENARY
Bit number for adding catenary.
SpriteID build_y_road
button for building single rail in Y direction
TrackdirBits
Enumeration of bitmasks for the TrackDirs.
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
Use this function to notify YAPF that track layout (or signal configuration) has change.
byte road_build_months
fund road reconstruction in action?
uint x
X position of the tile in unit coordinates.
static Vehicle * UpdateRoadVehPowerProc(Vehicle *v, void *data)
Update power of road vehicle under which is the roadtype being converted.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
static bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slope tileh_new, DiagDirection entrance)
Autoslope check for tiles with an entrance on an edge.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
@ TO_BUILDINGS
company buildings - depots, stations, HQ, ...
Tile information, used while rendering the tile.
@ ROAD_TILE_CROSSING
Level crossing.
byte landscape
the landscape we're currently in
StringID railtype
Type of rail on the tile.
RoadTypes introduces_roadtypes
Bitmask of which other roadtypes are introduced when this roadtype is introduced.
static bool IsTransparencySet(TransparencyOption to)
Check if the transparency option bit is set and if we aren't in the game menu (there's never transpar...
T * Next() const
Get next vehicle in the chain.
static bool IsValidDisallowedRoadDirections(DisallowedRoadDirections drt)
Checks if a DisallowedRoadDirections is valid.
Owner owner[4]
Name of the owner(s)
byte sorting_order
The sorting order of this roadtype for the toolbar dropdown.
@ SND_21_ROAD_WORKS
31 == 0x1F Road reconstruction animation
Axis
Allow incrementing of DiagDirDiff variables.
@ SLOPE_NW
north and west corner are raised
static Axis OtherAxis(Axis a)
Select the other axis as provided.
static void SetTrackReservation(TileIndex t, TrackBits b)
Sets the reserved track bits of the tile.
static const uint LEVELCROSSING_TRACKBIT_FACTOR
Multiplier for how many regular track bits a level crossing counts.
static SpriteID GetRoadGroundSprite(const TileInfo *ti, Roadside roadside, const RoadTypeInfo *rti, uint offset, PaletteID *pal)
Get ground sprite to draw for a road tile.
@ RTSG_CROSSING
Level crossing overlay images.
static Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
static bool IsRoadDepotTile(TileIndex t)
Return whether a tile is a road depot tile.
void MarkDirtyAdjacentLevelCrossingTiles(TileIndex tile, Axis road_axis)
Find adjacent level crossing tiles in this multi-track crossing and mark them dirty.
static Money RoadConvertCost(RoadType from, RoadType to)
Calculates the cost of road conversion.
@ DIAGDIR_END
Used for iterations.
uint32 squared_town_zone_radius[HZB_END]
UpdateTownRadius updates this given the house count.
Tindex index
Index of this pool item.
void DrawRoadCatenary(const TileInfo *ti)
Draws the catenary for the given tile.
bool TrainOnCrossing(TileIndex tile)
Check if a level crossing tile has a train on it.
static TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
SpriteID build_depot
button for building depots
SpriteID sprite
The 'real' sprite.
int GetBridgeHeight(TileIndex t)
Get the height ('z') of a bridge.
SpriteID single_y
single piece of rail in Y direction, without ground
@ SLOPE_ELEVATED
bit mask containing all 'simple' slopes
static T KillFirstBit(T value)
Clear the first bit in an integer.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
uint16 tram_speed
Speed limit of tram (bridges and track)
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
static constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
RoadTileType
The different types of road tiles.
This struct contains all the info that is needed to draw and construct tracks.
bool include(std::vector< T > &vec, const T &item)
Helper function to append an item to a vector if it is not already contained Consider using std::set,...
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
@ VETSB_CONTINUE
Bit sets of the above specified bits.
@ ROADSIDE_BARREN
Road on barren land.
static bool IsStandardRoadStopTile(TileIndex t)
Is tile t a standard (non-drive through) road stop station?
static const uint BB_HEIGHT_UNDER_BRIDGE
Some values for constructing bounding boxes (BB).
static bool IsValidDiagDirection(DiagDirection d)
Checks if an integer value is a valid DiagDirection.
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.
uint GetPartialPixelZ(int x, int y, Slope corners)
Determines height at given coordinate of a slope.
static bool IsDriveThroughStopTile(TileIndex t)
Is tile t a drive through road stop station?
static const uint TILE_SIZE
Tile size in world coordinates.
void DrawBridgeMiddle(const TileInfo *ti)
Draw the middle bits of a bridge.
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
Draw the road depot sprite.
uint y
Y position of the tile in unit coordinates.
ClientSettings _settings_client
The current settings for this game.
void VehicleEnterDepot(Vehicle *v)
Vehicle entirely entered the depot, update its status, orders, vehicle windows, service it,...
TileIndex xy
town center tile
@ DC_NO_WATER
don't allow building on water
static uint TileY(TileIndex tile)
Get the Y component of a tile.
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
static const uint32 VALID_LEVEL_CROSSING_SLOPES
Constant bitset with safe slopes for building a level crossing.
static int GetSlopePixelZInCorner(Slope tileh, Corner corner)
Determine the Z height of a corner relative to TileZ.
static RoadBits GetCrossingRoadBits(TileIndex tile)
Get the road bits of a level crossing.
byte _display_opt
What do we want to draw/do?
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.
CursorID tunnel
Cursor for building a tunnel.
@ VEH_ROAD
Road vehicle type.
Date introduction_date
Introduction date.
static void TerminateRoadWorks(TileIndex t)
Terminate road works on a tile.
Owner
Enum for all companies/owners.
@ DC_EXEC
execute the given command
Used to only draw a part of the sprite.
CommandCost CheckforTownRating(DoCommandFlag flags, Town *t, TownRatingCheckType type)
Does the town authority allow the (destructive) action of the current company?
@ MP_ROAD
A tile with road (or tram tracks)
StringID GetErrorMessage() const
Returns the error message of a command.
CursorID depot
Cursor for building a depot.
Tile description for the 'land area information' tool.
static bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
Find out if the slope of the tile is suitable to build a depot of given direction.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
static Corner GetHighestSlopeCorner(Slope s)
Returns the highest corner of a slope (one corner raised or a steep slope).
@ ROTSG_CURSORS
Optional: Cursor and toolbar icon images.
static Track GetCrossingRailTrack(TileIndex tile)
Get the rail track of a level crossing.
DoCommandFlag
List of flags for a command.
@ TRACKDIR_Y_SE
Y-axis and direction to south-east.
@ INVALID_ROADTYPE
flag for invalid roadtype
Foundation
Enumeration for Foundations.
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
CommandCost EnsureNoVehicleOnGround(TileIndex tile)
Ensure there is no vehicle at the ground at the given position.
CursorID road_nwse
Cursor for building rail in Y direction.
CursorID road_swne
Cursor for building rail in X direction.
static bool IsValidRoadBits(RoadBits r)
Whether the given roadtype is valid.
static Foundation FlatteningFoundation(Slope s)
Returns the foundation needed to flatten a slope.
static bool IsStraightRoad(RoadBits r)
Check if we've got a straight road.
@ TRACK_BIT_UPPER
Upper track.
std::tuple< CommandCost, Money > CmdRemoveLongRoad(DoCommandFlag flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, bool start_half, bool end_half)
Remove a long piece of road.
bool Succeeded() const
Did this command succeed?
static uint SlopeToSpriteOffset(Slope s)
Returns the Sprite offset for a given Slope.
static uint TileX(TileIndex tile)
Get the X component of a tile.
static TrackBits GetRailReservationTrackBits(TileIndex t)
Returns the reserved track bits of the tile.
static RoadBits DiagDirToRoadBits(DiagDirection d)
Create the road-part which belongs to the given DiagDirection.
std::vector< RoadTypeLabel > RoadTypeLabelList
List of road type labels.
static uint CountBits(T value)
Counts the number of set bits in a variable.
GameCreationSettings game_creation
settings used during the creation of a game (map)
@ TRACK_BIT_RIGHT
Right track.
static bool IncreaseRoadWorksCounter(TileIndex t)
Increase the progress counter of road works.
static bool CompareRoadTypes(const RoadType &first, const RoadType &second)
Compare roadtypes based on their sorting order.
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
Slope tileh
Slope of the tile.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
static RoadBits AxisToRoadBits(Axis a)
Create the road-part which belongs to the given Axis.
@ ROAD_X
Full road along the x-axis (south-west + north-east)
bool ambient
Play ambient, industry and town sounds.
StringID name
Name of this rail type.
Date build_date
Date of construction of tile contents.
PalSpriteID ground
Palette and sprite for the ground.
static void SetTunnelBridgeOwner(TileIndex begin, TileIndex end, Owner owner)
Sets the ownership of the bridge/tunnel ramps.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
Roadside
The possible road side decorations.
static bool DrawRoadAsSnowDesert(TileIndex tile, Roadside roadside)
Should the road be drawn as a unpaved snow/desert road? By default, roads are always drawn as unpaved...
static RoadBits GetAllRoadBits(TileIndex tile)
Get all set RoadBits on the given tile.
SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
bool RoadVehiclesAreBuilt()
Verify whether a road vehicle is available.
@ ROAD_TILE_NORMAL
Normal road.
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
static RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
Get the present road bits for a specific road type.
Slope
Enumeration for the slope-type.
@ ROADSIDE_STREET_LIGHTS
Road with street lights on paved sidewalks.
Iterator to iterate over a tile area (rectangle) of the map.
uint DistanceManhattan(TileIndex t0, TileIndex t1)
Gets the Manhattan distance between the two given tiles.
static int GetSlopeMaxZ(Slope s)
Returns the height of the highest corner of a slope relative to TileZ (= minimal height)
static void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence on tile with railroad specifics.
@ VS_HIDDEN
Vehicle is not visible.
RoadTypes powered_roadtypes
bitmask to the OTHER roadtypes on which a vehicle of THIS roadtype generates power
@ ROAD_ALL
Full 4-way crossing.
@ TRANSPORT_RAIL
Transport by train.
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
@ FOUNDATION_INCLINED_Y
The tile has an along Y-axis inclined foundation.
std::vector< RoadVehicle * > RoadVehicleList
Helper type for lists/vectors of road vehicles.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
static uint MapSize()
Get the size of the map.
@ ROAD_NE
North-east part.
@ TRACKDIR_BIT_X_NE
Track x-axis, direction north-east.
@ ROADSIDE_GRASS
Road on grass.
@ EXPENSES_CONSTRUCTION
Construction costs.
static RoadBits ComplementRoadBits(RoadBits r)
Calculate the complement of a RoadBits value.
static bool IsSteepSlope(Slope s)
Checks if a slope is steep.
Common return value for all commands.
byte GetSnowLine()
Get the current snow line, either variable or static.
Date _date
Current date in days (day counter)
static bool HasGrfMiscBit(GrfMiscBit bit)
Check for grf miscellaneous bits.
void InitRoadTypes()
Resolve sprites of custom road types.
SoundSettings sound
sound effect settings
@ ROTF_HIDDEN
Bit number for hidden from construction.
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...
RoadBits GetAnyRoadBits(TileIndex tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance)
Returns the RoadBits on an arbitrary tile Special behaviour:
@ SLOPE_NE
north and east corner are raised
static bool HasExactlyOneBit(T value)
Test whether value has exactly 1 bit set.
void DirtyCompanyInfrastructureWindows(CompanyID company)
Redraw all windows with company infrastructure counts.
Town * CalcClosestTownFromTile(TileIndex tile, uint threshold=UINT_MAX)
Return the town closest to the given tile within threshold.
static TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
Converts TrackBits to TrackdirBits while allowing both directions.
static RailTileType GetRailTileType(TileIndex t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
TileIndex tile
Current tile index.
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.
Base class for tile iterators.
static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadTramType rtt, bool crossing_check, bool town_check=true)
Delete a piece of road.
StringID roadtype
Type of road on the tile.
void ResetRoadTypes()
Reset all road type information to its default values.
TransportType
Available types of transport.
struct RailtypeInfo::@36 base_sprites
Struct containing the main sprites.
Cheats _cheats
All the cheats.
@ INVALID_OWNER
An invalid owner.
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.
SpriteID auto_road
button for the autoroad construction
@ FOUNDATION_INCLINED_X
The tile has an along X-axis inclined foundation.
static bool IsRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
Check if a specific road type is owned by an owner.
bool Failed() const
Did this command fail?
bool mod_road_rebuild
roadworks remove unnecessary RoadBits
static Roadside GetRoadside(TileIndex tile)
Get the decorations of a road.
static bool IsInvisibilitySet(TransparencyOption to)
Check if the invisibility option bit is set and if we aren't in the game menu (there's never transpar...
@ ROADSIDE_PAVED
Road with paved sidewalks.
static bool HasRoadCatenaryDrawn(RoadType roadtype)
Test if we should draw road catenary.
TileIndex GetNorthernBridgeEnd(TileIndex t)
Finds the northern end of a bridge starting at a middle tile.
void GetNameOfOwner(Owner owner, TileIndex tile)
Set the right DParams to get the name of an owner.
Represents the covered area of e.g.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
static const uint TUNNELBRIDGE_TRACKBIT_FACTOR
Multiplier for how many regular track bits a tunnel/bridge counts.
static bool HasTileRoadType(TileIndex t, RoadTramType rtt)
Check if a tile has a road or a tram road type.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
static TropicZone GetTropicZone(TileIndex tile)
Get the tropic zone.
RoadTypeLabelList alternate_labels
Road type labels this type provides in addition to the main label.
#define ToggleDesert
Toggle the snow/desert state of a road tile.
DisallowedRoadDirections
Which directions are disallowed ?
static const byte _roadveh_enter_depot_dir[4]
Given the direction the road depot is pointing, this is the direction the vehicle should be travellin...
EconomySettings economy
settings to change the economy
static bool IsCrossingBarred(TileIndex t)
Check if the level crossing is barred.
@ MAX_COMPANIES
Maximum number of companies.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
@ TRACK_BIT_X
X-axis track.
const TileTypeProcs _tile_type_road_procs
Tile callback functions for road tiles.
static RoadTileType GetRoadTileType(TileIndex t)
Get the type of the road tile.
CommandCost CmdBuildLongRoad(DoCommandFlag flags, TileIndex end_tile, TileIndex start_tile, RoadType rt, Axis axis, DisallowedRoadDirections drd, bool start_half, bool end_half, bool is_ai)
Build a long piece of road.
static TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
Builds a TrackStatus.
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
Money GetCost() const
The costs as made up to this moment.
static TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
static bool IsBridge(TileIndex t)
Checks if this is a bridge, instead of a tunnel.
@ TRACKDIR_BIT_Y_SE
Track y-axis, direction south-east.
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
static bool IsOnSnow(TileIndex t)
Check if a road tile has snow/desert.
Ground palette sprite of a tile, together with its sprite layout.
RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
Clean up unnecessary RoadBits of a planned tile.
@ ROADTYPE_ROAD
Basic road type.
void UpdateAdjacentLevelCrossingTilesOnLevelCrossingRemoval(TileIndex tile, Axis road_axis)
Update adjacent level crossing tiles in this multi-track crossing, due to removal of a level crossing...
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
static bool AutoslopeEnabled()
Tests if autoslope is enabled for _current_company.
Money GetAvailableMoneyForCommand()
@ TRACKDIR_X_NE
X-axis and direction to north-east.
uint32 road[ROADTYPE_END]
Count of company owned track bits for each road type.
static bool HasCrossingReservation(TileIndex t)
Get the reservation state of the rail crossing.
@ FOUNDATION_NONE
The tile has no foundation, the slope remains unchanged.
static bool IsRoadDepot(TileIndex t)
Return whether a tile is a road depot.
StringID name
Name of this rail type.
bool ValParamRoadType(RoadType roadtype)
Validate functions for rail building.
static DiagDirection GetRoadStopDir(TileIndex t)
Gets the direction the road stop entrance points towards.
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height)
Mark bridge tiles dirty.
DiagDirection
Enumeration for diagonal directions.
Slope GetFoundationSlope(TileIndex tile, int *z)
Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation,...
GRFLoadedFeatures _loaded_newgrf_features
Indicates which are the newgrf features currently loaded ingame.
@ TRACK_BIT_ALL
All possible tracks.
SpriteID build_tunnel
button for building a tunnel
@ ZOOM_LVL_DETAIL
All zoomlevels below or equal to this, will result in details on the screen, like road-work,...
@ ROADSIDE_TREES
Road with trees on paved sidewalks.
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
@ TRACK_BIT_LOWER
Lower track.
bool show_track_reservation
highlight reserved tracks.
CommandCost CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadTramType rtt, DoCommandFlag flags, bool town_check)
Is it allowed to remove the given road bits from the given tile?
@ DO_FULL_DETAIL
Also draw details of track and roads.
void DrawRoadOverlays(const TileInfo *ti, PaletteID pal, const RoadTypeInfo *road_rti, const RoadTypeInfo *tram_rti, uint road_offset, uint tram_offset, bool draw_underlay)
Draw road underlay and overlay sprites.
Set of callback functions for performing tile operations of a given tile type.
bool extra_dynamite
extra dynamite
@ RATING_ROAD_MINIMUM
minimum rating after removing town owned road
@ DRD_NONE
None of the directions are disallowed.
bool value
tells if the bool cheat is active or not
void UpdateNearestTownForRoadTiles(bool invalidate)
Updates cached nearest town for all road tiles.
@ DC_BANKRUPT
company bankrupts, skip money check, skip vehicle on tile check in some cases
static bool CanConvertUnownedRoadType(Owner owner, RoadTramType rtt)
Checks the tile and returns whether the current player is allowed to convert the roadtype to another ...
static DiagDirection AxisToDiagDir(Axis a)
Converts an Axis to a DiagDirection.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
@ DRD_SOUTHBOUND
All southbound traffic is disallowed.
static DiagDirection GetTunnelBridgeDirection(TileIndex t)
Get the direction pointing to the other end.
void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags)
Changes town rating of the current company.
static Owner GetTileOwner(TileIndex tile)
Returns the owner of a tile.
void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, int h, int dz, int z, bool transparent, int bb_offset_x, int bb_offset_y, int bb_offset_z, const SubSprite *sub)
Draw a (transparent) sprite at given coordinates with a given bounding box.
static void ConvertRoadTypeOwner(TileIndex tile, uint num_pieces, Owner owner, RoadType from_type, RoadType to_type)
Convert the ownership of the RoadType of the tile if applicable.
Direction direction
facing
static uint ApplyPixelFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
static void DrawTile_Road(TileInfo *ti)
Tile callback function for rendering a road tile to the screen.
bool _generating_world
Whether we are generating the map or not.
byte dist_local_authority
distance for town local authority, default 20
CommandCost CmdBuildRoad(DoCommandFlag flags, TileIndex tile, RoadBits pieces, RoadType rt, DisallowedRoadDirections toggle_drd, TownID town_id)
Build a piece of road.
uint DistanceSquare(TileIndex t0, TileIndex t1)
Gets the 'Square' distance between the two given tiles.
SpriteID build_x_road
button for building single rail in X direction
SpriteID convert_road
button for converting road types
static void SetRoadType(TileIndex t, RoadTramType rtt, RoadType rt)
Set the road type of a tile.
static Direction ReverseDir(Direction d)
Return the reverse of a direction.
void MakeDefaultName(T *obj)
Set the default name for a depot/waypoint.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
@ TRACKDIR_BIT_NONE
No track build.
static DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
Gets the disallowed directions.
static const uint ROAD_DEPOT_TRACKBIT_FACTOR
Multiplier for how many regular track bits a road depot counts.
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
CompanyID _current_company
Company currently doing an action.
static bool HasRoadCatenary(RoadType roadtype)
Test if a road type has catenary.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
static const PaletteID PALETTE_TO_BARE_LAND
sets colour to bare land stuff for rail, road and crossings
@ DRD_BOTH
All directions are disallowed.
static Slope SlopeWithOneCornerRaised(Corner corner)
Returns the slope with a specific corner raised.
struct RoadTypeInfo::@40 gui_sprites
struct containing the sprites for the road GUI.
@ TRACK_BIT_LEFT
Left track.
TramReplacement tram
In which way tram depots were replaced.
CommandCost CmdConvertRoad(DoCommandFlag flags, TileIndex tile, TileIndex area_start, RoadType to_type)
Convert one road subtype to another.
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
static const Date INVALID_DATE
Representation of an invalid date.
RoadTypeLabel label
Unique 32 bit road type identifier.
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
static void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
Sets the disallowed directions.
static bool IsSlopeWithOneCornerRaised(Slope s)
Tests if a specific slope has exactly one corner raised.
@ TRAMWAY_REPLACE_DEPOT_WITH_TRACK
Electrified depot graphics with tram track were loaded.
struct RoadTypeInfo::@41 cursor
Cursors associated with the road type.
TileType
The different types of tiles.
@ ROAD_TILE_DEPOT
Depot (one entrance)
@ TRACKDIR_BIT_Y_NW
Track y-axis, direction north-west.
uint32 PaletteID
The number of the palette.
static bool HasRailCatenaryDrawn(RailType rt)
Test if we should draw rail catenary.
bool build_on_slopes
allow building on slopes
@ ROTSG_OVERLAY
Optional: Images for overlaying track.
CursorID autoroad
Cursor for autorail tool.
static void DrawRoadDetail(SpriteID img, const TileInfo *ti, int dx, int dy, int h, bool transparent)
Draws details on/around the road.
static Money RoadClearCost(RoadType roadtype)
Returns the cost of clearing the specified roadtype.
@ TRACKDIR_Y_NW
Y-axis and direction to north-west.
@ SLOPE_SW
south and west corner are raised
static void SetTownIndex(TileIndex t, TownID index)
Set the town index for a road or house tile.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
@ OWNER_NONE
The tile has no ownership.
@ FOUNDATION_LEVELED
The tile is leveled up to a flat slope.
uint32 rail[RAILTYPE_END]
Count of company owned track bits for each rail type.
static void MakeRoadNormal(TileIndex t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
Make a normal road tile.
static TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
@ WC_VEHICLE_DEPOT
Depot view; Window numbers:
@ MP_STATION
A tile of a station.
@ ROTSG_CATENARY_FRONT
Optional: Catenary front.
TownCache cache
Container for all cacheable data.
static Axis GetCrossingRailAxis(TileIndex t)
Get the rail axis of a level crossing.
void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Find a vehicle from a specific location.
void UpdateCompanyRoadInfrastructure(RoadType rt, Owner o, int count)
Update road infrastructure counts for a company.
@ RAIL_TILE_NORMAL
Normal rail tile without signals.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
@ RATING_ROAD_DOWN_STEP_EDGE
removing a roadpiece at the edge
@ DIAGDIR_BEGIN
Used for iterations.
static const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
RoadType
The different roadtypes we support.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
StringID str
Description of the tile.
@ DC_AUTO
don't allow building on structures
static int GetTileMaxPixelZ(TileIndex tile)
Get top height of the tile.
A special vehicle is one of the following:
EffectVehicle * CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type)
Create an effect vehicle above a particular location.
RoadBits
Enumeration for the road parts on a tile.
static Pool::IterateWrapper< RoadVehicle > Iterate(size_t from=0)
Returns an iterable ensemble of all valid vehicles of type T.
static bool IsLevelCrossingTile(TileIndex t)
Return whether a tile is a level crossing tile.
void DrawGroundSpriteAt(SpriteID image, PaletteID pal, int32 x, int32 y, int z, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
Draws a ground sprite at a specific world-coordinate relative to the current tile.
#define IsOnDesert
Check if a road tile has snow/desert.
void UpdateLevelCrossing(TileIndex tile, bool sound=true, bool force_bar=false)
Update a level crossing to barred or open (crossing may include multiple adjacent tiles).
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
TrackBits
Bitfield corresponding to Track.
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
static Foundation GetRoadFoundation(Slope tileh, RoadBits bits)
Get the foundationtype of a RoadBits Slope combination.
static uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
Calculates the length of a tunnel or a bridge (without end tiles)
Date build_date
Date of construction.
@ ROAD_NW
North-west part.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
@ ROAD_SW
South-west part.
#define lengthof(x)
Return the length of an fixed size array.
@ ROTSG_DEPOT
Optional: Depot images.
uint16 rail_speed
Speed limit of rail (bridges and track)
@ ROAD_NONE
No road-part is build.
static TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track bits incidating with that diagdir.
uint16 max_speed
Maximum speed for vehicles travelling on this road type.
@ ROAD_SE
South-east part.
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
void DrawRoadTypeCatenary(const TileInfo *ti, RoadType rt, RoadBits rb)
Draws the catenary for the RoadType of the given tile.
void DrawRailCatenary(const TileInfo *ti)
Draws overhead wires and pylons for electric railways.
static Money RoadBuildCost(RoadType roadtype)
Returns the cost of building the specified roadtype.
static bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
Checks if an engine of the given RoadType got power on a tile with a given RoadType.
static bool IsNormalRoadTile(TileIndex t)
Return whether a tile is a normal road tile.
static void SetRoadside(TileIndex tile, Roadside s)
Set the decorations of a road.
@ TRANSPORT_ROAD
Transport by road vehicle.
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.
@ RATING_ROAD_DOWN_STEP_INNER
removing a roadpiece in the middle
StringID owner_type[4]
Type of each owner.
static Axis GetCrossingRoadAxis(TileIndex t)
Get the road axis of a level crossing.
@ TRACKDIR_BIT_X_SW
Track x-axis, direction south-west.
static TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
Determines type of the wormhole and returns its other end.
static const uint ROAD_STOP_TRACKBIT_FACTOR
Multiplier for how many regular track bits a bay stop counts.
RoadType AllocateRoadType(RoadTypeLabel label, RoadTramType rtt)
Allocate a new road type label.
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
static uint GetRoadSpriteOffset(Slope slope, RoadBits bits)
Get the sprite offset within a spritegroup.
@ TRACK_BIT_Y
Y-axis track.
TileIndex tile
Tile index.
static const RoadBits _invalid_tileh_slopes_road[2][15]
Invalid RoadBits on slopes.
ConstructionSettings construction
construction of things in-game
static RoadBits MirrorRoadBits(RoadBits r)
Calculate the mirrored RoadBits.
@ ROTFB_NONE
All flags cleared.
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
SpriteID crossing
level crossing, rail in X direction
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
struct RailtypeInfo::@39 strings
Strings associated with the rail type.
VehicleType type
Type of vehicle.
@ TRACKDIR_X_SW
X-axis and direction to south-west.
StringID tramtype
Type of tram on the tile.
T * First() const
Get the first vehicle in the chain.
RoadTypes _roadtypes_type
Bitmap of road/tram types.
static bool RoadNoLevelCrossing(RoadType roadtype)
Test if road disallows level crossings.
@ TUNNELBRIDGE_REMOVE
Removal of a tunnel or bridge owned by the towb.
static Slope GetTilePixelSlope(TileIndex tile, int *h)
Return the slope of a given tile.
Track
These are used to specify a single track.
uint ApplyFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existing, RoadBits other)
Calculate the costs for roads on slopes Aside modify the RoadBits to fit on the slopes.
@ ROAD_REMOVE
Removal of a road owned by the town.
void ShowDepotWindow(TileIndex tile, VehicleType type)
Opens a depot window.
static TransportType GetTunnelBridgeTransportType(TileIndex t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
static TrackBits GetCrossingRailBits(TileIndex tile)
Get the rail track bits of a level crossing.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
@ ROADTYPES_NONE
No roadtypes.
@ RVSB_IN_DEPOT
The vehicle is in a depot.
static bool HasRoadWorks(TileIndex t)
Check if a tile has road works.
@ OWNER_WATER
The tile/execution is done by "water".
#define CLRBITS(x, y)
Clears several bits in a variable.
@ ROTSG_CATENARY_BACK
Optional: Catenary back.
@ ROADTYPE_BEGIN
Used for iterations.
static bool CanConnectToRoad(TileIndex tile, RoadType rt, DiagDirection dir)
Checks whether a road or tram connection can be found when building a new road or tram.
CommandCost CmdBuildRoadDepot(DoCommandFlag flags, TileIndex tile, RoadType rt, DiagDirection dir)
Build a road depot.
static const SpriteID SPR_ONEWAY_BASE
One way road sprites.
VehicleEnterTileStatus
The returned bits of VehicleEnterTile.
@ OWNER_TOWN
A town owns the tile, or a town is expanding.
@ DRD_NORTHBOUND
All northbound traffic is disallowed.
CommandCost TunnelBridgeIsFree(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
Finds vehicle in tunnel / bridge.
void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
Draws a ground sprite for the current tile.
GUISettings gui
settings related to the GUI
@ ROADSIDE_GRASS_ROAD_WORKS
Road on grass with road works.
static bool MayHaveRoad(TileIndex t)
Test whether a tile can have road/tram types.
static const SpriteID SPR_TRAMWAY_BASE
Tramway sprites.
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
struct RoadTypeInfo::@42 strings
Strings associated with the rail type.
@ VETSB_ENTERED_WORMHOLE
The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/...
static bool IsBridgeAbove(TileIndex t)
checks if a bridge is set above the ground of this tile
uint16 road_speed
Speed limit of road (bridges and track)