43#include "table/strings.h"
66 for (
TileIndex t = begin; t != end; t += delta) {
84 std::ranges::copy(_orig_bridge, std::begin(
_bridge));
95 if (length < 2)
return length;
99 for (
int delta = 1;; delta++) {
100 for (
int count = 0; count < delta; count++) {
101 if (length == 0)
return sum;
145 assert(piece < NUM_BRIDGE_PIECES);
158 assert(piece < NUM_BRIDGE_PIECES);
161 if (piece < bridge->sprite_table.size() && !bridge->
sprite_table[piece].empty())
return bridge->
sprite_table[piece];
163 return _bridge_sprite_table[bridge_type][piece];
174 switch (transport_type) {
177 default: NOT_REACHED();
189 static constexpr uint8_t ramp_offsets[
DIAGDIR_END] = {2, 1, 0, 3};
190 return ramp_offsets[diagdir];
200 return axis ==
AXIS_X ? 0 : 4;
214 assert(bridge_piece == BRIDGE_PIECE_NORTH || bridge_piece == BRIDGE_PIECE_SOUTH);
219 Slope valid_inclined;
220 if (bridge_piece == BRIDGE_PIECE_NORTH) {
266 Money base_cost =
_price[base_price];
297 return Command<Commands::LandscapeClear>::Do(flags, tile);
315 for (
TileIndex t : {tile_start, tile_end}) {
323 switch (transport_type) {
352 if (tile_start == tile_end) {
353 return CommandCost(STR_ERROR_CAN_T_START_AND_END_ON);
359 }
else if (
TileY(tile_start) ==
TileY(tile_end)) {
362 return CommandCost(STR_ERROR_START_AND_END_MUST_BE_IN);
365 if (tile_end < tile_start) std::swap(tile_start, tile_end);
371 if (ret.
Failed())
return ret;
379 bool pbs_reservation =
false;
386 if (z_start != z_end)
return CommandCost(STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT);
398 switch (transport_type) {
415 return CommandCost(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
420 RoadType existing_rt = RoadTypeIsRoad(roadtype) ? road_rt : tram_rt;
422 return CommandCost(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
428 if ((bridge_type ==
GetBridgeType(tile_start)) && (transport_type !=
TRANSPORT_ROAD || road_rt == roadtype || tram_rt == roadtype)) {
447 return CommandCost(STR_ERROR_AREA_IS_OWNED_BY_ANOTHER);
456 if (is_new_owner) owner = company;
460 for (
TileIndex tile = tile_start + delta; tile != tile_end; tile += delta) {
461 CommandCost ret = CheckBuildAbove(tile, flags, direction, z_start + 1);
462 if (ret.
Failed())
return ret;
471 CommandCost ret = Command<Commands::LandscapeClear>::Do(flags, tile_start);
472 if (ret.
Failed())
return ret;
475 if (terraform_cost_north.
Failed() || (terraform_cost_north.
GetCost() != 0 && !allow_on_slopes))
return CommandCost(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
479 ret = Command<Commands::LandscapeClear>::Do(flags, tile_end);
480 if (ret.
Failed())
return ret;
484 if (terraform_cost_south.
Failed() || (terraform_cost_south.
GetCost() != 0 && !allow_on_slopes))
return CommandCost(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
488 for (
TileIndex tile : {tile_start, tile_end}) {
497 for (
TileIndex tile = tile_start + delta; tile != tile_end; tile += delta) {
507 return CommandCost(STR_ERROR_BRIDGE_TOO_HIGH_FOR_TERRAIN);
512 return CommandCost(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
515 ret = CheckBuildAbove(tile, flags, direction, z_start + 1);
516 if (ret.
Failed())
return ret;
534 if (RoadTypeIsRoad(roadtype)) road_rt = roadtype;
535 if (RoadTypeIsTram(roadtype)) tram_rt = roadtype;
543 switch (transport_type) {
572 MakeRoadBridgeRamp(tile_start, owner, owner_road, owner_tram, bridge_type, dir, road_rt, tram_rt);
606 switch (transport_type) {
649 switch (transport_type) {
679 CommandCost ret = Command<Commands::LandscapeClear>::Do(flags, start_tile);
680 if (ret.
Failed())
return ret;
712 if (start_z == end_z)
break;
715 return CommandCost(STR_ERROR_ANOTHER_TUNNEL_IN_THE_WAY);
719 if (tiles == tiles_bump) {
740 ret = Command<Commands::LandscapeClear>::Do(flags, end_tile);
749 if (coa ==
nullptr) {
750 coa = &_cleared_object_areas.emplace_back(end_tile,
TileArea(end_tile, 1, 1));
767 assert(coa >= begin && coa < begin + _cleared_object_areas.size());
768 size_t coa_index = coa - begin;
769 assert(coa_index < UINT_MAX);
772 ret = std::get<0>(Command<Commands::TerraformLand>::Do(flags, end_tile, end_tileh & start_tileh,
false));
773 _cleared_object_areas[(uint)coa_index].first_tile = old_first_tile;
780 switch (transport_type) {
783 default: NOT_REACHED();
852 default: NOT_REACHED();
865 if (ret.
Failed())
return ret;
870 if (ret.
Failed())
return ret;
881 if (ret.
Failed())
return ret;
912 DoClearSquare(endtile);
928 DoClearSquare(endtile);
945 if (ret.
Failed())
return ret;
950 if (ret.
Failed())
return ret;
962 if (ret.
Failed())
return ret;
999 DoClearSquare(endtile);
1001 for (
TileIndex c = tile + delta; c != endtile; c += delta) {
1052 AddSortableSpriteToDraw(psid.
sprite, psid.
pal, x, y, z, {{0, 0, -PILLAR_Z_OFFSET}, {w, h, BB_HEIGHT_UNDER_BRIDGE}, {0, 0, PILLAR_Z_OFFSET}},
IsTransparencySet(
TO_BRIDGES), subsprite);
1069 for (cur_z = z_top; cur_z >= z_bottom; cur_z -=
TILE_HEIGHT) {
1070 DrawPillar(psid, x, y, cur_z, w, h,
nullptr);
1088 static const int bounding_box_size[2] = {16, 2};
1089 static const int back_pillar_offset[2] = { 0, 9};
1091 static const int INF = 1000;
1092 static const SubSprite half_pillar_sub_sprite[2][2] = {
1097 if (psid.
sprite == 0)
return;
1101 int z_front_north = ti->
z;
1102 int z_back_north = ti->
z;
1103 int z_front_south = ti->
z;
1104 int z_back_south = ti->
z;
1109 int z_front = std::max(z_front_north, z_front_south);
1110 int z_back = std::max(z_back_north, z_back_south);
1113 int w = bounding_box_size[axis];
1114 int h = bounding_box_size[
OtherAxis(axis)];
1116 int x_back = x - back_pillar_offset[axis];
1117 int y_back = y - back_pillar_offset[
OtherAxis(axis)];
1121 if (z_front_north < z_front)
DrawPillar(psid, x, y, bottom_z, w, h, &half_pillar_sub_sprite[axis][0]);
1122 if (z_front_south < z_front)
DrawPillar(psid, x, y, bottom_z, w, h, &half_pillar_sub_sprite[axis][1]);
1125 int z_bridge_back = z_bridge - 2 * (int)
TILE_HEIGHT;
1126 if (drawfarpillar && (z_back_north <= z_bridge_back || z_back_south <= z_bridge_back)) {
1127 bottom_z =
DrawPillarColumn(z_back, z_bridge_back, psid, x_back, y_back, w, h);
1128 if (z_back_north < z_back)
DrawPillar(psid, x_back, y_back, bottom_z, w, h, &half_pillar_sub_sprite[axis][0]);
1129 if (z_back_south < z_back)
DrawPillar(psid, x_back, y_back, bottom_z, w, h, &half_pillar_sub_sprite[axis][1]);
1144 static const SpriteID back_offsets[6] = { 95, 96, 99, 102, 100, 101 };
1145 static const SpriteID front_offsets[6] = { 97, 98, 103, 106, 104, 105 };
1150 if (spr_back == 0 && spr_front == 0) {
1154 if (spr_back != 0) spr_back += 23 + offset;
1155 if (spr_front != 0) spr_front += 23 + offset;
1177 bool trans_back[4] = {
false };
1179 bool trans_front[4] = {
false };
1181 static const SpriteID overlay_offsets[6] = { 0, 1, 11, 12, 13, 14 };
1185 if (road_rti !=
nullptr) {
1186 if (road_rti->UsesOverlay()) {
1188 }
else if (is_custom_layout) {
1190 seq_back[0] = SPR_BRIDGE_DECKS_ROAD + offset;
1192 }
else if (tram_rti !=
nullptr) {
1193 if (tram_rti->UsesOverlay()) {
1196 seq_back[0] = SPR_TRAMWAY_BRIDGE + offset;
1202 if (road_rti !=
nullptr) {
1203 if (road_rti->UsesOverlay()) {
1205 if (seq_back[1] != 0) seq_back[1] += overlay_offsets[offset];
1211 if (tram_rti !=
nullptr) {
1212 if (tram_rti->UsesOverlay()) {
1214 if (seq_back[2] != 0) seq_back[2] += overlay_offsets[offset];
1215 }
else if (road_rti !=
nullptr) {
1216 seq_back[2] = SPR_TRAMWAY_OVERLAY + overlay_offsets[offset];
1241 for (uint i = 0; i <
lengthof(seq_back); ++i) {
1242 if (seq_back[i] != 0) {
1252 {{15, 0, 0}, {0,
TILE_SIZE, 40}, {-15, 0, 0}},
1253 {{0, 15, 0}, {
TILE_SIZE, 0, 40}, {0, -15, 0}},
1254 {{0, 15, 0}, {
TILE_SIZE, 0, 40}, {0, -15, 0}},
1255 {{15, 0, 0}, {0,
TILE_SIZE, 40}, {-15, 0, 0}},
1256 {{0, 15, 0}, {
TILE_SIZE, 0, 40}, {0, -15, 0}},
1257 {{15, 0, 0}, {0,
TILE_SIZE, 40}, {-15, 0, 0}},
1260 for (uint i = 0; i <
lengthof(seq_front); ++i) {
1261 if (seq_front[i] != 0) {
1326 bool catenary =
false;
1333 if (rti->UsesOverlay()) {
1339 image = SPR_TUNNEL_ENTRY_REAR_ROAD;
1344 image += tunnelbridge_direction * 2;
1353 bool draw_underlay =
true;
1356 if (road_rti !=
nullptr) {
1357 if (road_rti->UsesOverlay()) {
1361 draw_underlay =
false;
1365 if (tram_rti->UsesOverlay()) {
1369 draw_underlay =
false;
1374 DrawRoadOverlays(ti, PAL_NONE, road_rti, tram_rti, sprite_offset, sprite_offset, draw_underlay);
1380 if (catenary_sprite_base == 0) {
1381 catenary_sprite_base = SPR_TRAMWAY_TUNNEL_WIRES;
1383 catenary_sprite_base += 19;
1387 if (catenary_sprite_base == 0) {
1388 catenary_sprite_base = SPR_TRAMWAY_TUNNEL_WIRES;
1390 catenary_sprite_base += 19;
1394 if (catenary_sprite_base != 0) {
1401 if (rti->UsesOverlay()) {
1403 if (surface != 0)
DrawGroundSprite(surface + tunnelbridge_direction, PAL_NONE);
1408 if (rti->UsesOverlay()) {
1431 if (railtype_overlay != 0)
AddSortableSpriteToDraw(railtype_overlay + tunnelbridge_direction, PAL_NONE, *ti, roof_bounds[tunnelbridge_direction],
false);
1442 bool is_custom_layout =
false;
1445 std::span<const PalSpriteID> psid;
1455 psid = psid.subspan(base_offset, 1);
1460 DrawShoreTile(ti->
tileh);
1462 DrawClearLandTile(ti, 3);
1480 uint offset = tunnelbridge_direction;
1483 offset = (offset + 1) & 1;
1495 if (is_custom_layout || rti->UsesOverlay()) {
1508 if (rti->UsesOverlay()) {
1530 BridgePillarFlags blocked_pillars;
1562 return BRIDGE_PIECE_NORTH;
1563 }
else if (south == 1) {
1564 return BRIDGE_PIECE_SOUTH;
1565 }
else if (north < south) {
1566 return north & 1 ? BRIDGE_PIECE_INNER_SOUTH : BRIDGE_PIECE_INNER_NORTH;
1567 }
else if (north > south) {
1568 return south & 1 ? BRIDGE_PIECE_INNER_NORTH : BRIDGE_PIECE_INNER_SOUTH;
1570 return north & 1 ? BRIDGE_PIECE_MIDDLE_EVEN : BRIDGE_PIECE_MIDDLE_ODD;
1585 if (transport_type ==
TRANSPORT_WATER)
return BRIDGEPILLARFLAGS_ALL_CORNERS;
1595 return BRIDGEPILLARFLAGS_ALL_CORNERS;
1627 BridgePillarFlags pillars;
1628 bool is_custom_layout;
1631 std::span<const PalSpriteID> psid;
1642 drawfarpillar =
true;
1644 pillars = BRIDGEPILLARFLAGS_ALL_CORNERS;
1646 psid = psid.subspan(base_offset, 3);
1662 AddSortableSpriteToDraw(psid[0].sprite, psid[0].pal, x, y, z, {{0, 0,
BRIDGE_Z_START}, {
TILE_SIZE, 1, 40}, {0, 0, -
BRIDGE_Z_START}},
IsTransparencySet(
TO_BRIDGES));
1664 AddSortableSpriteToDraw(psid[0].sprite, psid[0].pal, x, y, z, {{0, 0,
BRIDGE_Z_START}, {1,
TILE_SIZE, 40}, {0, 0, -
BRIDGE_Z_START}},
IsTransparencySet(
TO_BRIDGES));
1676 AddSortableSpriteToDraw(surface + axis, PAL_NONE, x, y, bridge_z, {{}, {
TILE_SIZE,
TILE_SIZE, 0}, {}},
IsTransparencySet(
TO_BRIDGES));
1681 if (rti->UsesOverlay()) {
1683 AddSortableSpriteToDraw(overlay +
RTO_X + axis,
PALETTE_CRASH, ti->
x, ti->
y, bridge_z, {{}, {TILE_SIZE, TILE_SIZE, 0}, {}},
IsTransparencySet(
TO_BRIDGES));
1685 AddSortableSpriteToDraw(axis ==
AXIS_X ? rti->
base_sprites.
single_x : rti->
base_sprites.
single_y,
PALETTE_CRASH, ti->
x, ti->
y, bridge_z, {{}, {TILE_SIZE, TILE_SIZE, 0}, {}},
IsTransparencySet(
TO_BRIDGES));
1700 if (psid[1].sprite &
SPRITE_MASK)
AddSortableSpriteToDraw(psid[1].sprite, psid[1].pal, x, y, z, {{0, 3,
BRIDGE_Z_START}, {
TILE_SIZE, 1, 40}, {0, -3, -
BRIDGE_Z_START}},
IsTransparencySet(
TO_BRIDGES));
1703 if (psid[1].sprite &
SPRITE_MASK)
AddSortableSpriteToDraw(psid[1].sprite, psid[1].pal, x, y, z, {{3, 0,
BRIDGE_Z_START}, {1,
TILE_SIZE, 40}, {-3, 0, -
BRIDGE_Z_START}},
IsTransparencySet(
TO_BRIDGES));
1713 if (blocked_pillars.
Any(pillars))
return;
1728 if (ground_vehicle)
return z;
1734 if (ground_vehicle) {
1738 default: NOT_REACHED();
1762 td.
str = (tt ==
TRANSPORT_RAIL) ? STR_LAI_TUNNEL_DESCRIPTION_RAILROAD : STR_LAI_TUNNEL_DESCRIPTION_ROAD;
1790 td.
owner_type[i] = STR_LAND_AREA_INFORMATION_ROAD_OWNER;
1791 td.
owner[i] = road_owner;
1795 td.
owner_type[i] = STR_LAND_AREA_INFORMATION_TRAM_OWNER;
1796 td.
owner[i] = tram_owner;
1808 if (spd == UINT16_MAX) spd = 0;
1816 if (spd == UINT16_MAX) spd = 0;
1881 Company::Get(old_owner)->infrastructure.road[rt] -= num_pieces * 2;
1930template <
typename T>
2007 assert(frame == rv->frame + 1);
2058 default: NOT_REACHED();
2092 default: NOT_REACHED();
2121 return Command<Commands::LandscapeClear>::Do(flags, tile);
2133 return Command<Commands::LandscapeClear>::Do(flags, tile);
Functions related to autoslope.
bool AutoslopeEnabled()
Tests if autoslope is enabled for _current_company.
constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
constexpr T ClrBit(T &x, const uint8_t y)
Clears a bit in a variable.
const BridgeSpec * GetBridgeSpec(BridgeType i)
Get the specification of a bridge type.
static const uint MAX_BRIDGES
Maximal number of available bridge specs.
BridgeSpec _bridge[MAX_BRIDGES]
The specification of all bridges.
This file contains all the sprites for bridges.
static const PalSpriteID _aqueduct_sprite_table_middle[]
Sprite table for middle part of aqueduct.
static const PalSpriteID _aqueduct_sprite_table_heads[]
Sprite table for head part of aqueduct.
TileIndex GetSouthernBridgeEnd(TileIndex t)
Finds the southern end of a bridge starting at a middle tile.
TileIndex GetOtherBridgeEnd(TileIndex tile)
Starting at one bridge end finds the other bridge end.
TileIndex GetNorthernBridgeEnd(TileIndex t)
Finds the northern end of a bridge starting at a middle tile.
int GetBridgeHeight(TileIndex t)
Get the height ('z') of a bridge.
void SetBridgeMiddle(Tile t, Axis a)
Set that there is a bridge over the given axis.
void MakeAqueductBridgeRamp(Tile t, Owner o, DiagDirection d)
Make a bridge ramp for aqueducts.
bool IsBridgeTile(Tile t)
checks if there is a bridge on this tile
void MakeRailBridgeRamp(Tile t, Owner o, BridgeType bridgetype, DiagDirection d, RailType rt)
Make a bridge ramp for rails.
int GetBridgePixelHeight(TileIndex tile)
Get the height ('z') of a bridge in pixels.
void ClearBridgeMiddle(Tile t)
Removes bridges from the given, that is bridges along the X and Y axis.
void MakeRoadBridgeRamp(Tile t, Owner o, Owner owner_road, Owner owner_tram, BridgeType bridgetype, DiagDirection d, RoadType road_rt, RoadType tram_rt)
Make a bridge ramp for roads.
BridgeType GetBridgeType(Tile t)
Determines the type of bridge on a tile.
bool IsBridgeAbove(Tile t)
checks if a bridge is set above the ground of this tile
Axis GetBridgeAxis(Tile t)
Get the axis of the bridge that goes over the tile.
bool IsBridge(Tile t)
Checks if this is a bridge, instead of a tunnel.
BridgePieces
This enum is related to the definition of bridge pieces, which is used to determine the proper sprite...
@ EdgeNE
Northeast edge is obstructed.
@ EdgeSW
Southwest edge is obstructed.
@ EdgeNW
Northwest edge is obstructed.
@ EdgeSE
Southeast edge is obstructed.
uint BridgeType
Bridge spec number.
Cheats _cheats
All the cheats.
Types related to cheating.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
constexpr Timpl & Reset()
Reset all bits.
constexpr Timpl & Set()
Set all bits.
constexpr bool Any(const Timpl &other) const
Test if any of the given values are set.
Common return value for all commands.
bool Succeeded() const
Did this command succeed?
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
Money GetCost() const
The costs as made up to this moment.
bool Failed() const
Did this command fail?
This struct contains all the info that is needed to draw and construct tracks.
SpriteID single_x
single piece of rail in X direction, without ground
uint16_t max_speed
Maximum speed for vehicles travelling on this rail type.
struct RailTypeInfo::@157247141350136173143103254227157213063052244122 strings
Strings associated with the rail type.
SpriteID bridge_deck
bridge deck sprites base
SpriteID single_y
single piece of rail in Y direction, without ground
StringID name
Name of this rail type.
uint8_t bridge_offset
Bridge offset.
struct RailTypeInfo::@332027037331076264023214171276243307073252216167 base_sprites
Struct containing the main sprites.
SpriteID tunnel
tunnel sprites base
SpriteID single_sloped
single piece of rail for slopes
uint16_t max_speed
Maximum speed for vehicles travelling on this road type.
struct RoadTypeInfo::@070000167274302256150317022075324310363002361255 strings
Strings associated with the rail type.
StringID name
Name of this rail type.
static Year year
Current year, starting at 0.
Functions related to clear (TileType::Clear) land.
CommandCost CommandCostWithParam(StringID str, uint64_t value)
Return an error status, with string and parameter.
Functions related to commands.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
@ Auto
don't allow building on structures
@ QueryCost
query cost only, don't build.
@ Execute
execute the given command
@ Bankrupt
company bankrupts, skip money check, skip vehicle on tile check in some cases
Definition of stuff that is very close to a company, like the company struct itself.
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
CompanyID _current_company
Company currently doing an action.
void DirtyCompanyInfrastructureWindows(CompanyID company)
Redraw all windows with company infrastructure counts.
GUI Functions related to companies.
static constexpr Owner OWNER_DEITY
The object is owned by a superuser / goal script.
static constexpr Owner OWNER_TOWN
A town owns the tile, or a town is expanding.
static constexpr Owner OWNER_NONE
The tile has no ownership.
static constexpr Owner INVALID_OWNER
An invalid owner.
static constexpr Owner OWNER_WATER
The tile/execution is done by "water".
DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
DiagDirection AxisToDiagDir(Axis a)
Converts an Axis to a DiagDirection.
Axis OtherAxis(Axis a)
Select the other axis as provided.
Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
Axis
Allow incrementing of DiagDirDiff variables.
DiagDirection
Enumeration for diagonal directions.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
@ DIAGDIR_END
Used for iterations.
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
Prices _price
Prices and also the fractional part.
@ EXPENSES_CONSTRUCTION
Construction costs.
static const uint TUNNELBRIDGE_TRACKBIT_FACTOR
Multiplier for how many regular track bits a tunnel/bridge counts.
Price
Enumeration of all base prices for use with Prices.
@ ClearTunnel
Price for destroying tunnels.
@ BuildFoundation
Price for building foundation under other constructions e.g. roads, rails, depots,...
@ ClearAqueduct
Price for destroying aqueducts.
@ BuildAqueduct
Price for building new aqueducts.
@ BuildTunnel
Price for building tunnels.
@ BuildBridge
Price for building bridges.
@ ClearBridge
Price for destroying bridges.
void DrawRailCatenaryOnBridge(const TileInfo *ti)
Draws wires on a tunnel tile.
void DrawRailCatenaryOnTunnel(const TileInfo *ti)
Draws wires on a tunnel tile.
void DrawRailCatenary(const TileInfo *ti)
Draws overhead wires and pylons for electric railways.
Header file for electrified rail specific functions.
bool HasRailCatenaryDrawn(RailType rt)
Test if we should draw rail catenary.
#define T
Climate temperate.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23).
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
@ GVF_GOINGDOWN_BIT
Vehicle is currently going downhill. (Cached track information for acceleration).
@ GVF_GOINGUP_BIT
Vehicle is currently going uphill. (Cached track information for acceleration).
uint8_t GetSnowLine()
Get the current snow line, either variable or static.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
@ TownEdge
Edge of the town; roads without pavement.
uint GetPartialPixelZ(int x, int y, Slope corners)
Determines height at given coordinate of a slope.
const EnumClassIndexContainer< std::array< const TileTypeProcs *, to_underlying(TileType::MaxSize)>, TileType > _tile_type_procs
Tile callback functions for each type of tile.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
const TileTypeProcs _tile_type_tunnelbridge_procs
TileTypeProcs definitions for TileType::TunnelBridge tiles.
void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int &z1, int &z2)
Determine the Z height of the corners of a specific tile edge.
uint ApplyFoundationToSlope(Foundation f, Slope &s)
Applies a foundation to a slope.
int GetSlopePixelZ(int x, int y, bool ground_vehicle)
Return world Z coordinate of a given point of a tile.
uint ApplyPixelFoundationToSlope(Foundation f, Slope &s)
Applies a foundation to a slope.
Command definitions related to landscape (slopes etc.).
@ Arctic
Landscape with snow levels.
@ Tropic
Landscape with distinct rainforests and deserts,.
uint DistanceSquare(TileIndex t0, TileIndex t1)
Gets the 'Square' distance between the two given tiles.
TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
TileIndexDiff TileOffsByAxis(Axis axis)
Convert an Axis to a TileIndexDiff.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
static uint TileX(TileIndex tile)
Get the X component of a tile.
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
int32_t TileIndexDiff
An offset value between two tiles.
constexpr T abs(const T a)
Returns the absolute value of (scalar) variable.
@ TCX_ON_BRIDGE
Querying information about stuff on the bridge (via some bridgehead).
@ TCX_NORMAL
Nothing special.
SpriteID GetCustomRailSprite(const RailTypeInfo *rti, TileIndex tile, RailSpriteType rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
NewGRF handling of rail types.
SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadSpriteType rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
NewGRF handling of road types.
bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event, bool force)
Checks whether a NewGRF wants to play a different vehicle sound effect.
Functions related to NewGRF provided sounds.
@ VSE_TUNNEL
Train entering a tunnel.
ClearedObjectArea * FindClearedObject(TileIndex tile)
Find the entry in _cleared_object_areas which occupies a certain tile.
Train * GetTrainForReservation(TileIndex tile, Track track)
Find the train which has reserved a specific path.
bool ValParamRailType(const RailType rail)
Validate functions for rail building.
@ RTBO_Y
Piece of rail in Y direction.
@ RTBO_X
Piece of rail in X direction.
@ RTBO_SLOPE
Sloped rail pieces, in order NE, SE, SW, NW.
@ TunnelPortal
Tunnel portal overlay.
@ Overlay
Images for overlaying track.
@ Bridge
Bridge surface images.
@ Tunnel
Main group of ground images for snow or desert.
Money RailClearCost(RailType railtype)
Returns the 'cost' of clearing the specified railtype.
Money RailBuildCost(RailType railtype)
Returns the cost of building the specified railtype.
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
@ RTO_SLOPE_NE
Piece of rail on slope with north-east raised.
@ RTO_X
Piece of rail in X direction.
static const int INF
Big number compared to tilesprite size.
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
RailType
Enumeration for all possible railtypes.
bool ValParamRoadType(RoadType roadtype)
Validate functions for rail building.
Money RoadClearCost(RoadType roadtype)
Returns the cost of clearing the specified roadtype.
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
@ CatenaryFront
Optional: Catenary front.
@ Overlay
Optional: Images for overlaying track.
@ CatenaryRear
Optional: Catenary back.
@ Bridge
Required: Bridge surface images.
@ Tunnel
Optional: Ground images for tunnels.
Money RoadBuildCost(RoadType roadtype)
Returns the cost of building the specified roadtype.
void UpdateCompanyRoadInfrastructure(RoadType rt, Owner o, int count)
Update road infrastructure counts for a company.
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.
bool HasRoadCatenaryDrawn(RoadType roadtype)
Test if we should draw road catenary.
void SetRoadOwner(Tile t, RoadTramType rtt, Owner o)
Set the owner of a specific road type.
RoadType GetRoadTypeRoad(Tile t)
Get the road type for RoadTramType being RoadTramType::Road.
bool HasTileRoadType(Tile t, RoadTramType rtt)
Check if a tile has a road or a tram road type.
RoadType GetRoadTypeTram(Tile t)
Get the road type for RoadTramType being RoadTramType::Tram.
Roadside GetRoadside(Tile tile)
Get the decorations of a road.
RoadType GetRoadType(Tile t, RoadTramType rtt)
Get the road type for the given RoadTramType.
static bool IsNormalRoadTile(Tile t)
Return whether a tile is a normal road tile.
Owner GetRoadOwner(Tile t, RoadTramType rtt)
Get the owner of a specific road type.
void SetRoadside(Tile tile, Roadside s)
Set the decorations of a road.
@ Paved
Road with paved sidewalks.
@ Trees
Road with trees on paved sidewalks.
static constexpr RoadTramTypes ROADTRAMTYPES_ALL
All possible RoadTramTypes.
RoadType
The different roadtypes we support.
@ INVALID_ROADTYPE
flag for invalid roadtype
RoadTramType
The different types of road type.
@ RVSB_WORMHOLE
The vehicle is in a tunnel and/or bridge.
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
ClientSettings _settings_client
The current settings for this game.
void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner)
Add side of tile to signal update buffer.
uint SlopeToSpriteOffset(Slope s)
Returns the Sprite offset for a given Slope.
bool HasSlopeHighestCorner(Slope s)
Tests if a slope has a highest corner (i.e.
Foundation FlatteningFoundation(Slope s)
Returns the foundation needed to flatten a slope.
DiagDirection GetInclinedSlopeDirection(Slope s)
Returns the direction of an inclined slope.
Foundation InclinedFoundation(Axis axis)
Returns the along a specific axis inclined foundation.
Slope ComplementSlope(Slope s)
Return the complement of a slope.
Slope
Enumeration for the slope-type.
@ SLOPE_SW
south and west corner are raised
@ SLOPE_NE
north and east corner are raised
@ SLOPE_SE
south and east corner are raised
@ SLOPE_NW
north and west corner are raised
Foundation
Enumeration for Foundations.
@ FOUNDATION_NONE
The tile has no foundation, the slope remains unchanged.
Functions related to sound.
@ SND_05_TRAIN_THROUGH_TUNNEL
3 == 0x03 Train enters tunnel: steam engine
static constexpr uint32_t SPRITE_MASK
The mask to for the main sprite.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
static const SpriteID SPR_RAILTYPE_TUNNEL_BASE
Tunnel sprites with grass only for custom railtype tunnel.
static const SpriteID SPR_TRAMWAY_BASE
Tramway sprites.
Definition of base types and functions in a cross-platform compatible way.
#define lengthof(array)
Return the length of an fixed size array.
Functions related to OTTD's strings.
VehicleType type
Type of vehicle.
Struct containing information about a single bridge type.
ControlFlags ctrl_flags
control flags
@ InvalidPillarFlags
Bridge pillar flags are not valid, i.e. only the tile layout has been modified.
uint8_t min_length
the minimum length (not counting start and end tile)
BridgeMiddlePillarFlags pillar_flags
bridge pillar flags.
std::vector< std::vector< PalSpriteID > > sprite_table
table of sprites for drawing the bridge
TimerGameCalendar::Year avail_year
the year where it becomes available
StringID transport_name[2]
description of the bridge, when built for road or rail
uint16_t speed
maximum travel speed (1 unit = 1/1.6 mph = 1 km-ish/h)
uint16_t max_length
the maximum length (not counting start and end tile)
Keeps track of removed objects during execution/testruns of commands.
TileIndex first_tile
The first tile being cleared, which then causes the whole object to be cleared.
std::array< uint32_t, ROADTYPE_END > road
Count of company owned track bits for each road type.
std::array< uint32_t, RAILTYPE_END > rail
Count of company owned track bits for each rail type.
uint32_t water
Count of company owned track bits for canals.
bool is_ai
If true, the company is (also) controlled by the computer (a NoAI program).
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
static uint MaxX()
Gets the maximum X coordinate within the map, including TileType::Void.
Combination of a palette sprite and a 'real' sprite.
SpriteID sprite
The 'real' sprite.
PaletteID pal
The palette (use PAL_NONE) if not needed).
static Company * Get(auto index)
static bool IsValidID(auto index)
static Company * GetIfValid(auto index)
Buses, trucks and trams belong to this class.
All ships have this type.
TrackBits state
The "track" the ship is following.
static Train * From(Vehicle *v)
Used to only draw a part of the sprite.
Tile description for the 'land area information' tool.
uint16_t rail_speed
Speed limit of rail (bridges and track).
StringID str
Description of the tile.
std::array< Owner, 4 > owner
Name of the owner(s).
uint16_t tram_speed
Speed limit of tram (bridges and track).
StringID roadtype
Type of road on the tile.
StringID tramtype
Type of tram on the tile.
StringID railtype
Type of rail on the tile.
uint16_t road_speed
Speed limit of road (bridges and track).
std::array< StringID, 4 > owner_type
Type of each owner.
Tile information, used while rendering the tile.
Slope tileh
Slope of the tile.
TileIndex tile
Tile index.
Set of callback functions for performing tile operations of a given tile type.
std::array< uint32_t, NUM_HOUSE_ZONES > squared_town_zone_radius
UpdateTownRadius updates this given the house count.
TileIndex xy
town center tile
TownCache cache
Container for all cacheable data.
'Train' is either a loco or a wagon.
TrackBits track
On which track the train currently is.
EngineID engine_type
The type of engine used for this vehicle.
int32_t z_pos
z coordinate.
Direction GetMovingDirection() const
Get the moving direction of this vehicle chain.
bool IsMovingFront() const
Is this vehicle the moving front of the vehicle chain?
VehStates vehstatus
Status.
Vehicle * First() const
Get the first vehicle of this vehicle chain.
uint16_t cur_speed
current speed
TileIndex tile
Current tile index.
@ CannotEnter
The vehicle cannot enter the tile.
@ EnteredWormhole
The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/...
std::tuple< Slope, int > GetTileSlopeZ(TileIndex tile)
Return the slope of a given tile inside the map.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
static uint TileHeight(Tile tile)
Returns the height of a tile.
bool IsTileOwner(Tile tile, Owner owner)
Checks if a tile belongs to the given owner.
Owner GetTileOwner(Tile tile)
Returns the owner of a tile.
void SetTileOwner(Tile tile, Owner owner)
Sets the owner of a tile.
std::tuple< Slope, int > GetTilePixelSlope(TileIndex tile)
Return the slope of a given tile.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
TropicZone GetTropicZone(Tile tile)
Get the tropic zone.
static TileType GetTileType(Tile tile)
Get the tiletype of a given tile.
static constexpr uint TILE_UNIT_MASK
For masking in/out the inner-tile world coordinate units.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
static constexpr uint TILE_SIZE
Tile size in world coordinates.
static constexpr uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in ZOOM_BASE.
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
Definition of the game-calendar-timer.
void ChangeTownRating(Town *t, int add, int max, DoCommandFlags flags)
Changes town rating of the current company.
@ TunnelBridgeRemove
Removal of a tunnel or bridge owned by the town.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
Town * CalcClosestTownFromTile(TileIndex tile, uint threshold=UINT_MAX)
Return the town closest to the given tile within threshold.
CommandCost CheckforTownRating(DoCommandFlags flags, Town *t, TownRatingCheckType type)
Does the town authority allow the (destructive) action of the current company?
static constexpr int RATING_TUNNEL_BRIDGE_UP_STEP
rating increase for improving a town-owned bridge
static constexpr int RATING_TUNNEL_BRIDGE_MINIMUM
minimum rating after removing tunnel or bridge
static constexpr int RATING_TUNNEL_BRIDGE_DOWN_STEP
penalty for removing town owned tunnel or bridge
TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
Converts TrackBits to TrackdirBits while allowing both directions.
TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
Builds a TrackStatus.
TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track bits incidating with that diagdir.
Trackdir DiagDirToDiagTrackdir(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal trackdir that runs in that direction.
Track AxisToTrack(Axis a)
Convert an Axis to the corresponding Track AXIS_X -> TRACK_X AXIS_Y -> TRACK_Y Uses the fact that the...
Track DiagDirToDiagTrack(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track incidating with that diagdir.
@ TRACK_BIT_WORMHOLE
Bitflag for a wormhole (used for tunnels).
@ TRACKDIR_BIT_NONE
No track build.
Track
These are used to specify a single track.
Base for the train class.
bool TryPathReserve(Train *v, bool mark_as_stuck=false, bool first_tile_okay=false)
Try to reserve a path to a safe position.
void FreeTrainTrackReservation(const Train *v)
Free the reserved path in front of a vehicle.
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...
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...
TransportType
Available types of transport.
@ TRANSPORT_RAIL
Transport by train.
@ TRANSPORT_ROAD
Transport by road vehicle.
@ TRANSPORT_WATER
Transport over water.
bool IsTunnelInWayDir(TileIndex tile, int z, DiagDirection dir)
Is there a tunnel in the way in the given direction?
TileIndex GetOtherTunnelEnd(TileIndex tile)
Gets the other end of the tunnel.
void MakeRailTunnel(Tile t, Owner o, DiagDirection d, RailType r)
Makes a rail tunnel entrance.
bool IsTunnel(Tile t)
Is this a tunnel (entrance)?
void MakeRoadTunnel(Tile t, Owner o, DiagDirection d, RoadType road_rt, RoadType tram_rt)
Makes a road tunnel entrance.
Header file for things common for tunnels and bridges.
uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
Calculates the length of a tunnel or a bridge (without end tiles).
TileIndex _build_tunnel_endtile
The end of a tunnel; as hidden return from the tunnel build command for GUI purposes.
static Foundation GetFoundation_TunnelBridge(TileIndex tile, Slope tileh)
Tile callback function signature for getting the foundation of a tile.
static void GetTileDesc_TunnelBridge(TileIndex tile, TileDesc &td)
Tile callback function signature for obtaining a tile description.
CommandCost CmdBuildBridge(DoCommandFlags flags, TileIndex tile_end, TileIndex tile_start, TransportType transport_type, BridgeType bridge_type, RailType railtype, RoadType roadtype)
Build a Bridge.
static CommandCost ClearTile_TunnelBridge(TileIndex tile, DoCommandFlags flags)
Tile callback function signature for clearing a tile.
CommandCost CmdBuildTunnel(DoCommandFlags flags, TileIndex start_tile, TransportType transport_type, RailType railtype, RoadType roadtype)
Build Tunnel.
static void DrawBridgePillars(const PalSpriteID &psid, const TileInfo *ti, Axis axis, bool drawfarpillar, int x, int y, int z_bridge)
Draws the pillars under high bridges.
static BridgePieces CalcBridgePiece(uint north, uint south)
Compute bridge piece.
static bool BridgeHasCustomSpriteTable(BridgeType bridge_type, BridgePieces piece)
Test if bridge piece uses a custom sprite table.
static CommandCost CheckAllowRemoveTunnelBridge(TileIndex tile)
Are we allowed to remove the tunnel or bridge at tile?
static Money TunnelBridgeClearCost(TileIndex tile, Price base_price)
Calculate the base cost of clearing a tunnel/bridge per tile.
Foundation GetBridgeFoundation(Slope tileh, Axis axis)
Get the foundation for a bridge.
const uint8_t _tunnel_visibility_frame[DIAGDIR_END]
Frame when a vehicle should be hidden in a tunnel with a certain direction.
static int GetSlopePixelZ_TunnelBridge(TileIndex tile, uint x, uint y, bool ground_vehicle)
Tile callback function signature for obtaining the world Z coordinate of a given point of a tile.
static void ChangeTileOwner_TunnelBridge(TileIndex tile, Owner old_owner, Owner new_owner)
Tile callback function signature for changing the owner of a tile.
static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlags flags)
Remove a tunnel from the game, update town rating, etc.
static CommandCost DoClearBridge(TileIndex tile, DoCommandFlags flags)
Remove a bridge from the game, update town rating, etc.
static CommandCost CheckBuildAbove_TunnelBridge(TileIndex tile, DoCommandFlags flags, Axis axis, int height)
Tile callback function signature to test if a bridge can be built above a tile.
static VehicleEnterTileStates VehicleEnterTile_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y)
Tile callback function for a vehicle entering a tile.
static int DrawPillarColumn(int z_bottom, int z_top, const PalSpriteID &psid, int x, int y, int w, int h)
Draw two bridge pillars (north and south).
static BridgePillarFlags GetBridgeTilePillarFlags(TileIndex tile, TileIndex rampnorth, TileIndex rampsouth, BridgeType type, TransportType transport_type)
Get pillar information for a bridge middle tile.
static void DrawPillar(const PalSpriteID &psid, int x, int y, int z, uint8_t w, uint8_t h, const SubSprite *subsprite)
Draw a single pillar sprite.
static uint8_t GetBridgeRampDirectionBaseOffset(DiagDirection diagdir)
Get bridge sprite table base offset for the ramp part of bridge.
CommandCost CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoCommandFlags flags)
Is a bridge of the specified type and length available?
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height)
Mark bridge tiles dirty.
static TrackStatus GetTileTrackStatus_TunnelBridge(TileIndex tile, TransportType mode, RoadTramType sub_mode, DiagDirection side)
Tile callback function signature for getting the possible tracks that can be taken on a given tile by...
bool HasBridgeFlatRamp(Slope tileh, Axis axis)
Determines if the track on a bridge ramp is flat or goes up/down.
static void DrawTile_TunnelBridge(TileInfo *ti)
Tile callback function signature for drawing a tile and its contents to the screen.
void DrawBridgeMiddle(const TileInfo *ti, BridgePillarFlags blocked_pillars)
Draw the middle bits of a bridge.
static std::span< const PalSpriteID > GetBridgeSpriteTable(BridgeType bridge_type, BridgePieces piece)
Get the sprite table for a rail/road bridge piece.
static const int BRIDGE_Z_START
Z position of the bridge sprites relative to bridge height (downwards).
static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlags flags, int z_new, Slope tileh_new)
Tile callback function signature of the terraforming callback.
static uint8_t GetBridgeMiddleAxisBaseOffset(Axis axis)
Get bridge sprite table base offset for the middle part of bridge.
static void GetBridgeRoadCatenary(const RoadTypeInfo *rti, TileIndex head_tile, int offset, bool head, SpriteID &spr_back, SpriteID &spr_front)
Retrieve the sprites required for catenary on a road/tram bridge.
int CalcBridgeLenCostFactor(int length)
Calculate the price factor for building a long bridge.
static void PrepareToEnterBridge(T *gv)
Helper to prepare the ground vehicle when entering a bridge.
static uint8_t GetBridgeSpriteTableBaseOffset(TransportType transport_type, TileIndex ramp)
Get the sprite table transport type base offset for a rail/road bridge.
void ResetBridges()
Reset the data been eventually changed by the grf loaded.
static void TileLoop_TunnelBridge(TileIndex tile)
Tile callback function signature for running periodic tile updates.
static CommandCost CheckBridgeSlope(BridgePieces bridge_piece, Axis axis, Slope &tileh, int &z)
Determines the foundation for the bridge head, and tests if the resulting slope is valid.
static void DrawBridgeRoadBits(TileIndex head_tile, int x, int y, int z, int offset, bool head, bool is_custom_layout)
Draws the road and trambits over an already drawn (lower end) of a bridge.
static const uint8_t TUNNEL_SOUND_FRAME
Frame when the 'enter tunnel' sound should be played.
Command definitions related to tunnels and bridges.
Functions that have tunnels and bridges in common.
void SetTunnelBridgeSnowOrDesert(Tile t, bool snow_or_desert)
Tunnel: Places this tunnel entrance in a snowy or desert area, or takes it out of there.
DiagDirection GetTunnelBridgeDirection(Tile t)
Get the direction pointing to the other end.
bool HasTunnelBridgeSnowOrDesert(Tile t)
Tunnel: Is this tunnel entrance in a snowy or desert area?
bool HasTunnelBridgeReservation(Tile t)
Get the reservation state of the rail tunnel/bridge.
TransportType GetTunnelBridgeTransportType(Tile t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
TileIndex GetOtherTunnelBridgeEnd(Tile t)
Determines type of the wormhole and returns its other end.
void SetTunnelBridgeReservation(Tile t, bool b)
Set the reservation state of the rail tunnel/bridge.
CommandCost TunnelBridgeIsFree(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
Finds vehicle in tunnel / bridge.
@ Hidden
Vehicle is not visible.
Functions related to vehicles.
@ VEH_ROAD
Road vehicle type.
@ VEH_SHIP
Ship vehicle type.
@ VEH_TRAIN
Train vehicle type.
void StartSpriteCombine()
Starts a block of sprites, which are "combined" into a single bounding box.
void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int z, const SpriteBounds &bounds, bool transparent, const SubSprite *sub)
Draw a (transparent) sprite at given coordinates with a given bounding box.
void EndSpriteCombine()
Terminates a block of sprites started by StartSpriteCombine.
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.
Functions related to (drawing on) viewports.
static constexpr int BB_Z_SEPARATOR
Separates the bridge/tunnel from the things under/above it.
Functions related to water management.
void CheckForDockingTile(TileIndex t)
Mark the supplied tile as a docking tile if it is suitable for docking.
bool HasTileWaterGround(Tile t)
Checks whether the tile has water at the ground.
bool HasTileWaterClass(Tile t)
Checks whether the tile has an waterclass associated.
WaterClass GetWaterClass(Tile t)
Get the water class at a tile.
Entry point for OpenTTD to YAPF's cache.
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
Use this function to notify YAPF that track layout (or signal configuration) has change.