OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
46 #include "table/strings.h"
55 std::vector<RoadType> _sorted_roadtypes;
81 if (cursors_base != 0) {
105 if (RoadTypeIsRoad(first) == RoadTypeIsRoad(second)) {
108 return RoadTypeIsTram(first) < RoadTypeIsTram(second);
118 ResolveRoadTypeGUISprites(rti);
122 _sorted_roadtypes.clear();
124 if (_roadtypes[rt].label != 0 && !
HasBit(_roadtypes_hidden_mask, rt)) {
125 _sorted_roadtypes.push_back(rt);
128 std::sort(_sorted_roadtypes.begin(), _sorted_roadtypes.end(),
CompareRoadTypes);
139 if (rti->
label == 0) {
162 if (rtt == RTT_TRAM) {
195 if (c ==
nullptr)
return;
290 if (ret.
Failed())
return ret;
336 if (ret.
Failed())
return ret;
344 if (ret.
Failed())
return ret;
351 if (ret.
Failed())
return ret;
360 if (ret.
Failed())
return ret;
436 if (pieces ==
ROAD_NONE)
return_cmd_error((rtt == RTT_TRAM) ? STR_ERROR_THERE_IS_NO_TRAMWAY : STR_ERROR_THERE_IS_NO_ROAD);
562 RoadBits type_bits = existing | *pieces;
575 type_bits = existing | *pieces;
623 town_id = (town !=
nullptr) ? town->
index : INVALID_TOWN;
640 RoadTramType rtt = GetRoadTramType(rt);
642 bool need_to_clear =
false;
649 other_bits =
GetRoadBits(tile, OtherRoadTramType(rtt));
658 if ((existing & pieces) == pieces) {
660 if (toggle_drd !=
DRD_NONE && rtt == RTT_ROAD) {
666 if (ret.
Failed())
return ret;
678 if (ret.
Failed())
return ret;
696 if (ret.
Failed())
return ret;
718 default: NOT_REACHED();
734 if (ret.
Failed())
return ret;
750 if (pieces &
ROAD_X)
goto do_clear;
755 if (pieces &
ROAD_Y)
goto do_clear;
759 default:
goto do_clear;
763 if (ret.
Failed())
return ret;
795 if (pieces & ~curbits)
goto do_clear;
809 if (ret.
Failed())
return ret;
815 need_to_clear =
true;
822 if (ret.
Failed())
return ret;
826 if (other_bits != pieces) {
837 if (!need_to_clear) {
856 if (ret.
Failed())
return ret;
862 RoadType existing_rt = GetRoadType(tile, rtt);
868 if (ret.
Failed())
return ret;
955 RoadTramType rtt = GetRoadTramType(rt);
956 RoadType existing = GetRoadType(tile, rtt);
992 if (start_tile > end_tile || (start_tile == end_tile && start_half)) {
994 start_half = !start_half;
995 end_half = !end_half;
1007 bool had_bridge =
false;
1008 bool had_tunnel =
false;
1009 bool had_success =
false;
1016 if (!is_ai && start_tile != end_tile) {
1033 if (is_ai)
return last_error;
1034 if (had_success)
break;
1056 if (tile == end_tile)
break;
1061 return had_success ? cost : last_error;
1087 if (start_tile > end_tile || (start_tile == end_tile && start_half)) {
1088 std::swap(start_tile, end_tile);
1089 std::swap(start_half, end_half);
1093 Money money_spent = 0;
1096 bool had_success =
false;
1106 RoadTramType rtt = GetRoadTramType(rt);
1111 if (money_spent > 0 && money_spent > money_available) {
1121 case STR_ERROR_OWNED_BY:
1122 case STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS:
1130 if (tile == end_tile)
break;
1135 return { had_success ? cost : last_error, 0 };
1160 cost.
AddCost(_price[PR_BUILD_FOUNDATION]);
1164 bool rotate_existing_depot =
false;
1165 if (
IsRoadDepotTile(tile) && (HasRoadTypeTram(tile) ? rt == GetRoadTypeTram(tile) : rt == GetRoadTypeRoad(tile)))
1168 if (ret.
Failed())
return ret;
1173 if (ret.
Failed())
return ret;
1175 rotate_existing_depot =
true;
1178 if (!rotate_existing_depot) {
1180 if (cost.
Failed())
return cost;
1188 if (rotate_existing_depot) {
1203 cost.
AddCost(_price[PR_BUILD_DEPOT_ROAD]);
1211 if (ret.
Failed())
return ret;
1215 if (ret.
Failed())
return ret;
1221 RoadType rt = GetRoadTypeRoad(tile);
1227 delete Depot::GetByTile(tile);
1228 DoClearSquare(tile);
1243 for (RoadTramType rtt : _roadtramtypes) {
1247 if (tmp_ret.
Failed())
return tmp_ret;
1262 for (RoadTramType rtt : { RTT_TRAM, RTT_ROAD }) {
1266 if (tmp_ret.
Failed())
return tmp_ret;
1281 return RemoveRoadDepot(tile, flags);
1323 const uint8_t _road_sloped_sprites[14] = {
1344 default: NOT_REACHED();
1347 static const uint offsets[] = {
1353 return offsets[bits];
1368 return (snow_or_desert &&
1396 RoadType rt_road = GetRoadTypeRoad(neighbour);
1397 RoadType rt_tram = GetRoadTypeTram(neighbour);
1406 if (
CountBits(rb_new) >= 2) rb = rb_new;
1413 if (front != 0 || back != 0) {
1417 back = SPR_TRAMWAY_BACK_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1418 front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1433 static const int INF = 1000;
1434 static const SubSprite west = { -INF, -INF, -12, INF };
1435 static const SubSprite north = { -12, -INF, 12, INF };
1436 static const SubSprite east = { 12, -INF, INF, INF };
1437 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 16, 1, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 15, 0,
GetSlopePixelZInCorner(ti->
tileh, CORNER_W), &west);
1438 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 1, 1, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 0,
GetSlopePixelZInCorner(ti->
tileh, CORNER_N), &north);
1439 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 1, 16, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 15,
GetSlopePixelZInCorner(ti->
tileh, CORNER_E), &east);
1443 AddSortableSpriteToDraw(front, pal, ti->
x, ti->
y, 16, 16, z_wires + 1, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 0, z_wires);
1482 rt = GetRoadTypeTram(ti->
tile);
1517 if (draw_underlay) {
1519 if (road_rti !=
nullptr) {
1520 if (road_rti->UsesOverlay()) {
1525 if (tram_rti->UsesOverlay()) {
1535 if (road_rti !=
nullptr) {
1536 if (road_rti->UsesOverlay()) {
1543 if (tram_rti !=
nullptr) {
1544 if (tram_rti->UsesOverlay()) {
1547 }
else if (road_rti !=
nullptr) {
1565 if (rti ==
nullptr || rti->UsesOverlay()) {
1580 SpriteID image = SPR_ROAD_Y + offset;
1588 default: image -= 19;
break;
1641 if (road_rti !=
nullptr) {
1649 oneway += SPR_ONEWAY_SLOPE_N_OFFSET;
1651 oneway += SPR_ONEWAY_SLOPE_S_OFFSET;
1678 if (height < minz)
return;
1689 bool is_transparent =
false;
1691 is_transparent =
true;
1694 is_transparent =
true;
1698 for (
const DrawRoadTileStruct *drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
1699 DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10, is_transparent);
1726 if (rti->UsesOverlay()) {
1727 SpriteID image = SPR_ROAD_Y + axis;
1736 default: image -= 19;
break;
1752 default: image += 4;
break;
1763 if (rti->UsesOverlay()) {
1771 uint adjacent_diagdirs = 0;
1775 SetBit(adjacent_diagdirs, dir);
1779 switch (adjacent_diagdirs) {
1804 }
else if (draw_pbs || tram_rti !=
nullptr || road_rti->UsesOverlay()) {
1831 bool default_gfx = relocation == 0;
1836 relocation = SPR_TRAMWAY_DEPOT_WITH_TRACK - SPR_ROAD_DEPOT;
1837 default_gfx =
false;
1840 relocation = SPR_TRAMWAY_DEPOT_NO_TRACK - SPR_ROAD_DEPOT;
1844 relocation -= SPR_ROAD_DEPOT;
1853 if (rti->UsesOverlay()) {
1881 bool default_gfx = relocation == 0;
1886 relocation = SPR_TRAMWAY_DEPOT_WITH_TRACK - SPR_ROAD_DEPOT;
1887 default_gfx =
false;
1890 relocation = SPR_TRAMWAY_DEPOT_NO_TRACK - SPR_ROAD_DEPOT;
1894 relocation -= SPR_ROAD_DEPOT;
1902 if (rti->UsesOverlay()) {
1904 if (ground != 0)
DrawSprite(ground + offset, PAL_NONE, x, y);
1905 }
else if (RoadTypeIsTram(rt)) {
1906 DrawSprite(SPR_TRAMWAY_OVERLAY + offset, PAL_NONE, x, y);
1924 TownID tid = INVALID_TOWN;
1927 if (town !=
nullptr) tid = town->
index;
1934 static int GetSlopePixelZ_Road(
TileIndex tile, uint x, uint y,
bool)
1958 static const Roadside _town_road_types[][2] = {
1966 static_assert(
lengthof(_town_road_types) == HZB_END);
1968 static const Roadside _town_road_types_2[][2] = {
1976 static_assert(
lengthof(_town_road_types_2) == HZB_END);
1979 static void TileLoop_Road(
TileIndex tile)
2004 HouseZonesBits grp = HZB_TOWN_EDGE;
2034 if (cur_rs == new_rs[0])
return;
2037 if (cur_rs == new_rs[1]) {
2057 if (old_rb != new_rb) {
2071 if (rt != GetRoadTypeRoad(tile)) {
2080 static bool ClickTile_Road(
TileIndex tile)
2089 static const TrackBits _road_trackbits[16] = {
2118 RoadTramType rtt = (RoadTramType)sub_mode;
2122 const uint drd_to_multiplier[
DRD_END] = { 0x101, 0x100, 0x1, 0x0 };
2140 red_signals = trackdirbits;
2172 static const StringID _road_tile_strings[] = {
2173 STR_LAI_ROAD_DESCRIPTION_ROAD,
2174 STR_LAI_ROAD_DESCRIPTION_ROAD,
2175 STR_LAI_ROAD_DESCRIPTION_ROAD,
2176 STR_LAI_ROAD_DESCRIPTION_ROAD_WITH_STREETLIGHTS,
2177 STR_LAI_ROAD_DESCRIPTION_ROAD,
2178 STR_LAI_ROAD_DESCRIPTION_TREE_LINED_ROAD,
2179 STR_LAI_ROAD_DESCRIPTION_ROAD,
2180 STR_LAI_ROAD_DESCRIPTION_ROAD,
2189 RoadType road_rt = GetRoadTypeRoad(tile);
2190 RoadType tram_rt = GetRoadTypeTram(tile);
2206 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING;
2217 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_VEHICLE_DEPOT;
2233 bool mixed_owners = (tram_owner !=
INVALID_OWNER && tram_owner != first_owner) || (rail_owner !=
INVALID_OWNER && rail_owner != first_owner);
2238 td->
owner[0] = rail_owner;
2240 td->
owner[1] = road_owner;
2242 td->
owner[2] = tram_owner;
2245 td->
owner[0] = first_owner;
2264 if (rv->frame == RVC_DEPOT_STOP_FRAME &&
2292 RoadType rt = GetRoadTypeRoad(tile);
2298 for (RoadTramType rtt : _roadtramtypes) {
2308 for (RoadTramType rtt : _roadtramtypes) {
2311 RoadType rt = GetRoadType(tile, rtt);
2315 Company::Get(old_owner)->infrastructure.road[rt] -= num_bits;
2356 if (bits == bits_copy) {
2370 default: NOT_REACHED();
2450 RoadTramType rtt = GetRoadTramType(to_type);
2453 CommandCost error =
CommandCost((rtt == RTT_TRAM) ? STR_ERROR_NO_SUITABLE_TRAMWAY : STR_ERROR_NO_SUITABLE_ROAD);
2454 bool found_convertible_road =
false;
2456 std::unique_ptr<TileIterator> iter = std::make_unique<OrthogonalTileIterator>(area_start, area_end);
2462 RoadType from_type = GetRoadType(tile, rtt);
2473 error.
MakeError(STR_ERROR_CROSSING_DISALLOWED_ROAD);
2514 if (rtt == RTT_ROAD && owner ==
OWNER_TOWN) {
2528 found_convertible_road =
true;
2555 if (endtile < tile) {
2567 if (rtt == RTT_ROAD && owner ==
OWNER_TOWN) {
2576 found_convertible_road =
true;
2612 return found_convertible_road ? cost : error;
2619 GetSlopePixelZ_Road,
2623 GetTileTrackStatus_Road,
2627 ChangeTileOwner_Road,
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.
@ SLOPE_SE
south and east corner are raised
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
@ TRACKDIR_X_SW
X-axis and direction to south-west.
uint8_t _display_opt
What do we want to draw/do?
@ ROTSG_ONEWAY
Optional: One-way indicator images.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
@ TROPICZONE_DESERT
Tile is desert.
@ ROTSG_GROUND
Required: Main group of ground images.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
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-...
Direction ReverseDir(Direction d)
Return the reverse of a direction.
void StartRoadWorks(Tile t)
Start road works on a tile.
@ DRD_SOUTHBOUND
All southbound traffic is disallowed.
@ DRD_BOTH
All directions are disallowed.
Cheat magic_bulldozer
dynamite industries, objects
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
static Titem * Get(size_t index)
Returns Titem with given index.
DisallowedRoadDirections GetDisallowedRoadDirections(Tile t)
Gets the disallowed directions.
@ TO_HOUSES
town buildings
static const RoadTypeInfo _original_roadtypes[]
Global Roadtype definition.
Track GetCrossingRailTrack(Tile tile)
Get the rail track of a level crossing.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
void TerminateRoadWorks(Tile t)
Terminate road works on a tile.
SpriteID build_y_road
button for building single rail in Y direction
@ ROADSIDE_TREES
Road with trees on paved sidewalks.
RoadBits
Enumeration for the road parts on a tile.
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
Use this function to notify YAPF that track layout (or signal configuration) has change.
@ ROADTYPE_ROAD
Basic road type.
uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
Calculates the length of a tunnel or a bridge (without end tiles)
bool IsRoadOwner(Tile t, RoadTramType rtt, Owner o)
Check if a specific road type is owned by an owner.
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.
@ TRACK_BIT_X
X-axis track.
TimerGameCalendar::Date introduction_date
Introduction date.
Foundation FlatteningFoundation(Slope s)
Returns the foundation needed to flatten a slope.
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
Find out if the slope of the tile is suitable to build a depot of given direction.
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
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.
StringID railtype
Type of rail on the tile.
RoadTypes introduces_roadtypes
Bitmask of which other roadtypes are introduced when this roadtype is introduced.
T * Next() const
Get next vehicle in the chain.
Owner owner[4]
Name of the owner(s)
@ SND_21_ROAD_WORKS
31 == 0x1F Road reconstruction animation
@ SLOPE_NE
north and east corner are raised
Slope GetTileSlope(TileIndex tile)
Return the slope of a given tile inside the map.
static const uint LEVELCROSSING_TRACKBIT_FACTOR
Multiplier for how many regular track bits a level crossing counts.
@ INVALID_OWNER
An invalid owner.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Roadside GetRoadside(Tile tile)
Get the decorations of a road.
@ RTSG_CROSSING
Level crossing overlay images.
uint16_t road_speed
Speed limit of road (bridges and track)
@ ROAD_SE
South-east part.
@ ROTFB_NONE
All flags cleared.
void MarkDirtyAdjacentLevelCrossingTiles(TileIndex tile, Axis road_axis)
Find adjacent level crossing tiles in this multi-track crossing and mark them dirty.
void SetRoadType(Tile t, RoadTramType rtt, RoadType rt)
Set the road type of a tile.
TrackBits GetCrossingRailBits(Tile tile)
Get the rail track bits of a level crossing.
bool AutoslopeEnabled()
Tests if autoslope is enabled for _current_company.
Owner
Enum for all companies/owners.
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...
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.
Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
TileIndex TileAddXY(TileIndex tile, int x, int y)
Adds a given offset to a tile.
SpriteID build_depot
button for building depots
SpriteID sprite
The 'real' sprite.
int GetBridgeHeight(TileIndex t)
Get the height ('z') of a bridge.
@ ROAD_ALL
Full 4-way crossing.
void SetRoadDepotExitDirection(Tile tile, DiagDirection dir)
Sets the exit direction of a road depot.
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
RoadTileType
The different types of road tiles.
@ ROADTYPE_BEGIN
Used for iterations.
This struct contains all the info that is needed to draw and construct tracks.
@ VETSB_CONTINUE
Bit sets of the above specified bits.
static const uint BB_HEIGHT_UNDER_BRIDGE
Some values for constructing bounding boxes (BB).
static constexpr bool IsSteepSlope(Slope s)
Checks if a slope is steep.
uint GetPartialPixelZ(int x, int y, Slope corners)
Determines height at given coordinate of a slope.
@ VEH_ROAD
Road vehicle type.
static const uint TILE_SIZE
Tile size in world coordinates.
DiagDirection
Enumeration for diagonal directions.
void DrawBridgeMiddle(const TileInfo *ti)
Draw the middle bits of a bridge.
static debug_inline bool IsNormalRoad(Tile t)
Return whether a tile is a normal road.
bool IsLevelCrossingTile(Tile t)
Return whether a tile is a level crossing tile.
bool HasTownOwnedRoad(Tile t)
Checks if given tile has town owned road.
@ ROADSIDE_GRASS_ROAD_WORKS
Road on grass with road works.
@ SLOPE_NW
north and west corner are raised
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
Draw the road depot sprite.
bool IsLevelCrossing(Tile t)
Return whether a tile is a level crossing.
ClientSettings _settings_client
The current settings for this game.
void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32_t total_offset, uint32_t newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence in GUI with railroad specifics.
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
DiagDirection GetRoadStopDir(Tile t)
Gets the direction the road stop entrance points towards.
int y
Y position of the tile in unit coordinates.
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
CursorID tunnel
Cursor for building a tunnel.
@ TRACKDIR_BIT_Y_NW
Track y-axis, direction north-west.
struct RailTypeInfo::@26 strings
Strings associated with the rail type.
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
@ DC_EXEC
execute the given command
int GetSlopePixelZ(int x, int y, bool ground_vehicle)
Return world Z coordinate of a given point of a tile.
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?
uint32_t PaletteID
The number of the palette.
uint8_t landscape
the landscape we're currently in
@ 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.
constexpr bool HasExactlyOneBit(T value)
Test whether value has exactly 1 bit set.
bool Chance16(const uint32_t a, const uint32_t b, const std::source_location location=std::source_location::current())
Flips a coin with given probability.
@ ROTSG_CURSORS
Optional: Cursor and toolbar icon images.
DoCommandFlag
List of flags for a command.
Foundation
Enumeration for Foundations.
constexpr T KillFirstBit(T value)
Clear the first bit in an integer.
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.
@ ROAD_NW
North-west part.
uint8_t road_build_months
fund road reconstruction in action?
RoadBits GetCrossingRoadBits(Tile tile)
Get the road bits of a level crossing.
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?
GameCreationSettings game_creation
settings used during the creation of a game (map)
@ TRANSPORT_ROAD
Transport by road vehicle.
static bool CompareRoadTypes(const RoadType &first, const RoadType &second)
Compare roadtypes based on their sorting order.
void SetCrossingReservation(Tile t, bool b)
Set the reservation state of the rail crossing.
TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track bits incidating with that diagdir.
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.
RoadType GetTownRoadType()
Get the road type that towns should build at this current moment.
static debug_inline TileType GetTileType(Tile tile)
Get the tiletype of a given tile.
bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
Checks if an engine of the given RoadType got power on a tile with a given RoadType.
@ TRACK_BIT_NONE
No track.
static SpriteID GetRoadGroundSprite(const TileInfo *ti, Roadside roadside, const RoadTypeInfo *rti, uint offset, bool snow_or_desert, PaletteID *pal)
Get ground sprite to draw for a road tile.
bool ambient
Play ambient, industry and town sounds.
@ ROTF_CATENARY
Bit number for adding catenary.
DiagDirection GetRoadDepotDirection(Tile t)
Get the direction of the exit of a road depot.
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...
Money RoadBuildCost(RoadType roadtype)
Returns the cost of building the specified roadtype.
PalSpriteID ground
Palette and sprite for the ground.
bool include(Container &container, typename Container::const_reference &item)
Helper function to append an item to a container if it is not already contained.
TimerGameCalendar::Date build_date
Date of construction of tile contents.
void DrawRoadGroundSprites(const TileInfo *ti, RoadBits road, RoadBits tram, const RoadTypeInfo *road_rti, const RoadTypeInfo *tram_rti, Roadside roadside, bool snow_or_desert)
Draw road ground sprites.
StringID name
Name of this rail type.
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.
TransportType
Available types of transport.
@ ROADTYPES_NONE
No roadtypes.
uint DistanceManhattan(TileIndex t0, TileIndex t1)
Gets the Manhattan distance between the two given tiles.
@ VS_HIDDEN
Vehicle is not visible.
RoadTypes powered_roadtypes
bitmask to the OTHER roadtypes on which a vehicle of THIS roadtype generates power
uint8_t dist_local_authority
distance for town local authority, default 20
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.
void ToggleSnow(Tile t)
Toggle the snow/desert state of a road tile.
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.
TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
Converts TrackBits to TrackdirBits while allowing both directions.
bool IsBayRoadStopTile(Tile t)
Is tile t a bay (non-drive through) road stop station?
Money GetAvailableMoneyForCommand()
This functions returns the money which can be used to execute a command.
bool HasRoadCatenaryDrawn(RoadType roadtype)
Test if we should draw road catenary.
Common return value for all commands.
bool IsBridge(Tile t)
Checks if this is a bridge, instead of a tunnel.
uint ApplyPixelFoundationToSlope(Foundation f, Slope &s)
Applies a foundation to a slope.
void InitRoadTypes()
Resolve sprites of custom road types.
SoundSettings sound
sound effect settings
@ OWNER_NONE
The tile has no ownership.
static const uint8_t _roadveh_enter_depot_dir[4]
Given the direction the road depot is pointing, this is the direction the vehicle should be travellin...
TrackBits
Allow incrementing of Track variables.
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
void DirtyCompanyInfrastructureWindows(CompanyID company)
Redraw all windows with company infrastructure counts.
static const uint32_t VALID_LEVEL_CROSSING_SLOPES
Constant bitset with safe slopes for building a level crossing.
static constexpr int GetSlopeMaxZ(Slope s)
Returns the height of the highest corner of a slope relative to TileZ (= minimal height)
@ TRACKDIR_Y_SE
Y-axis and direction to south-east.
Town * CalcClosestTownFromTile(TileIndex tile, uint threshold=UINT_MAX)
Return the town closest to the given tile within threshold.
bool RoadNoLevelCrossing(RoadType roadtype)
Test if road disallows level crossings.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
Roadside
The possible road side decorations.
std::tuple< Slope, int > GetTilePixelSlope(TileIndex tile)
Return the slope of a given tile.
@ DRD_NONE
None of the directions are disallowed.
TileIndex tile
Current tile index.
@ ROAD_SW
South-west part.
bool MayHaveRoad(Tile t)
Test whether a tile can have road/tram types.
@ DIAGDIR_BEGIN
Used for iterations.
StringID roadtype
Type of road on the tile.
void ResetRoadTypes()
Reset all road type information to its default values.
TrackBits GetRailReservationTrackBits(Tile t)
Returns the reserved track bits of the tile.
Cheats _cheats
All the cheats.
void MakeError(StringID message, StringID extra_message=INVALID_STRING_ID)
Makes this CommandCost behave like an error command.
@ TRACKDIR_BIT_NONE
No track build.
SpriteID auto_road
button for the autoroad construction
@ FOUNDATION_INCLINED_X
The tile has an along X-axis inclined foundation.
DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
@ ROADSIDE_STREET_LIGHTS
Road with street lights on paved sidewalks.
bool Failed() const
Did this command fail?
bool mod_road_rebuild
roadworks remove unnecessary RoadBits
void SetRoadside(Tile tile, Roadside s)
Set the decorations of a road.
@ TRACK_BIT_LEFT
Left track.
TileIndex GetNorthernBridgeEnd(TileIndex t)
Finds the northern end of a bridge starting at a middle tile.
bool IsStraightRoad(RoadBits r)
Check if we've got a straight road.
Represents the covered area of e.g.
DiagDirection AxisToDiagDir(Axis a)
Converts an Axis to a DiagDirection.
static const uint TUNNELBRIDGE_TRACKBIT_FACTOR
Multiplier for how many regular track bits a tunnel/bridge counts.
struct RoadTypeInfo::@27 gui_sprites
struct containing the sprites for the road GUI.
TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
GameSettings _settings_game
Game settings of a running game or the scenario editor.
static bool DrawRoadAsSnowDesert(bool snow_or_desert, Roadside roadside)
Should the road be drawn as a unpaved snow/desert road? By default, roads are always drawn as unpaved...
uint ApplyFoundationToSlope(Foundation f, Slope &s)
Applies a foundation to a slope.
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.
RoadType
The different roadtypes we support.
EconomySettings economy
settings to change the economy
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
const TileTypeProcs _tile_type_road_procs
Tile callback functions for road tiles.
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.
#define lengthof(array)
Return the length of an fixed size array.
static debug_inline bool IsNormalRoadTile(Tile t)
Return whether a tile is a normal road tile.
bool HasTileRoadType(Tile t, RoadTramType rtt)
Check if a tile has a road or a tram road type.
Money GetCost() const
The costs as made up to this moment.
bool IsCrossingBarred(Tile t)
Check if the level crossing is barred.
static debug_inline RoadTileType GetRoadTileType(Tile t)
Get the type of the road tile.
void SetTrackReservation(Tile t, TrackBits b)
Sets the reserved track bits of the tile.
Ground palette sprite of a tile, together with its sprite layout.
TimerGameCalendar::Date build_date
Date of construction.
RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
Clean up unnecessary RoadBits of a planned tile.
Owner GetTileOwner(Tile tile)
Returns the owner of a tile.
bool HasGrfMiscBit(GrfMiscBit bit)
Check for grf miscellaneous bits.
void UpdateAdjacentLevelCrossingTilesOnLevelCrossingRemoval(TileIndex tile, Axis road_axis)
Update adjacent level crossing tiles in this multi-track crossing, due to removal of a level crossing...
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.
@ INVALID_ROADTYPE
flag for invalid roadtype
void SetDParamsForOwnedBy(Owner owner, TileIndex tile)
Set the right DParams for STR_ERROR_OWNED_BY.
bool HasRoadWorks(Tile t)
Check if a tile has road works.
@ FOUNDATION_NONE
The tile has no foundation, the slope remains unchanged.
StringID name
Name of this rail type.
bool ValParamRoadType(RoadType roadtype)
Validate functions for rail building.
RoadBits DiagDirToRoadBits(DiagDirection d)
Create the road-part which belongs to the given DiagDirection.
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height)
Mark bridge tiles dirty.
static debug_inline RailTileType GetRailTileType(Tile t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
void SetTunnelBridgeOwner(TileIndex begin, TileIndex end, Owner owner)
Sets the ownership of the bridge/tunnel ramps.
GRFLoadedFeatures _loaded_newgrf_features
Indicates which are the newgrf features currently loaded ingame.
uint8_t sorting_order
The sorting order of this roadtype for the toolbar dropdown.
TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
Builds a TrackStatus.
@ ROADSIDE_BARREN
Road on barren land.
SpriteID build_tunnel
button for building a tunnel
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
bool show_track_reservation
highlight reserved tracks.
bool IsValidAxis(Axis d)
Checks if an integer value is a valid Axis.
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
void SetTileOwner(Tile tile, Owner owner)
Sets the owner of a tile.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
constexpr uint CountBits(T value)
Counts the number of set bits in a variable.
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 ...
std::array< uint32_t, RAILTYPE_END > rail
Count of company owned track bits for each rail type.
@ OWNER_TOWN
A town owns the tile, or a town is expanding.
Money RoadClearCost(RoadType roadtype)
Returns the cost of clearing the specified roadtype.
@ TRACKDIR_Y_NW
Y-axis and direction to north-west.
struct RoadTypeInfo::@28 cursor
Cursors associated with the road type.
void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags)
Changes town rating of the current company.
@ TRACK_BIT_ALL
All possible tracks.
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.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
TrackBits GetTrackBits(Tile tile)
Gets the track bits of the given tile.
Direction direction
facing
uint16_t max_speed
Maximum speed for vehicles travelling on this rail type.
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
SpriteID single_x
single piece of rail in X direction, without ground
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
@ TRACK_BIT_UPPER
Upper track.
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.
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.
uint16_t tram_speed
Speed limit of tram (bridges and track)
SpriteID build_x_road
button for building single rail in X direction
@ ROADTYPE_END
Used for iterations.
SpriteID convert_road
button for converting road types
RoadBits GetAnyRoadBits(Tile tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance)
Returns the RoadBits on an arbitrary tile Special behaviour:
@ TRACKDIR_BIT_X_NE
Track x-axis, direction north-east.
void MakeDefaultName(T *obj)
Set the default name for a depot/waypoint.
void SetDisallowedRoadDirections(Tile t, DisallowedRoadDirections drd)
Sets the disallowed directions.
bool IsValidDiagDirection(DiagDirection d)
Checks if an integer value is a valid DiagDirection.
static const uint ROAD_DEPOT_TRACKBIT_FACTOR
Multiplier for how many regular track bits a road depot counts.
CompanyID _current_company
Company currently doing an action.
Track
These are used to specify a single track.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
void MakeRoadCrossing(Tile t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadType road_rt, RoadType tram_rt, uint town)
Make a level crossing.
static const PaletteID PALETTE_TO_BARE_LAND
sets colour to bare land stuff for rail, road and crossings
@ TRACK_BIT_RIGHT
Right 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.
Axis GetCrossingRoadAxis(Tile t)
Get the road axis of a level crossing.
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
RoadTypeLabel label
Unique 32 bit road type identifier.
Slope
Enumeration for the slope-type.
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
@ ROADSIDE_GRASS
Road on grass.
Axis
Allow incrementing of DiagDirDiff variables.
bool IsValidDisallowedRoadDirections(DisallowedRoadDirections drt)
Checks if a DisallowedRoadDirections is valid.
@ TRAMWAY_REPLACE_DEPOT_WITH_TRACK
Electrified depot graphics with tram track were loaded.
@ TRANSPORT_RAIL
Transport by train.
TileType
The different types of tiles.
@ TRACKDIR_X_NE
X-axis and direction to north-east.
Corner GetHighestSlopeCorner(Slope s)
Returns the highest corner of a slope (one corner raised or a steep slope).
static debug_inline uint Size()
Get the size of the map.
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
@ ROAD_TILE_DEPOT
Depot (one entrance)
RoadBits ComplementRoadBits(RoadBits r)
Calculate the complement of a RoadBits value.
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.
constexpr bool HasAtMostOneBit(T value)
Test whether value has at most 1 bit set.
@ OWNER_WATER
The tile/execution is done by "water".
DisallowedRoadDirections
Which directions are disallowed ?
@ SLOPE_SW
south and west corner are raised
@ ROAD_NE
North-east part.
int GetSlopePixelZInCorner(Slope tileh, Corner corner)
Determine the Z height of a corner relative to TileZ.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
bool IsValidRoadBits(RoadBits r)
Whether the given roadtype is valid.
void DrawGroundSpriteAt(SpriteID image, PaletteID pal, int32_t x, int32_t 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.
void SetRoadBits(Tile t, RoadBits r, RoadTramType rtt)
Set the present road bits for a specific road type.
@ FOUNDATION_LEVELED
The tile is leveled up to a flat slope.
std::array< uint32_t, ROADTYPE_END > road
Count of company owned track bits for each road type.
@ WC_VEHICLE_DEPOT
Depot view; Window numbers:
Owner GetRoadOwner(Tile t, RoadTramType rtt)
Get the owner of a specific road type.
@ MP_STATION
A tile of a station.
static constexpr TimerGame< struct Calendar >::Date INVALID_DATE
Representation of an invalid date.
@ ROTSG_CATENARY_FRONT
Optional: Catenary front.
TownCache cache
Container for all cacheable data.
static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadTramType rtt, bool town_check)
Delete a piece of road.
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()
bool HasRailCatenaryDrawn(RailType rt)
Test if we should draw rail catenary.
@ RATING_ROAD_DOWN_STEP_EDGE
removing a roadpiece at the edge
TransportType GetTunnelBridgeTransportType(Tile t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
@ DIAGDIR_END
Used for iterations.
@ SLOPE_ELEVATED
bit mask containing all 'simple' slopes
std::tuple< Slope, int > GetFoundationSlope(TileIndex tile)
Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation,...
RoadBits GetRoadBits(Tile t, RoadTramType rtt)
Get the present road bits for a specific road type.
bool IncreaseRoadWorksCounter(Tile t)
Increase the progress counter of road works.
bool IsBridgeAbove(Tile t)
checks if a bridge is set above the ground of this tile
StringID str
Description of the tile.
@ TRACK_BIT_Y
Y-axis track.
@ DC_AUTO
don't allow building on structures
A special vehicle is one of the following:
bool HasCrossingReservation(Tile t)
Get the reservation state of the rail crossing.
struct RoadTypeInfo::@29 strings
Strings associated with the rail type.
EffectVehicle * CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type)
Create an effect vehicle above a particular location.
void SetRoadOwner(Tile t, RoadTramType rtt, Owner o)
Set the owner of a specific road type.
@ ROAD_NONE
No road-part is build.
static Pool::IterateWrapper< RoadVehicle > Iterate(size_t from=0)
Returns an iterable ensemble of all valid vehicles of type T.
void SetTownIndex(Tile t, TownID index)
Set the town index for a road or house tile.
TileIndex GetOtherTunnelBridgeEnd(Tile t)
Determines type of the wormhole and returns its other end.
#define IsOnDesert
Check if a road tile has snow/desert.
Track AxisToTrack(Axis a)
Convert an Axis to the corresponding Track AXIS_X -> TRACK_X AXIS_Y -> TRACK_Y Uses the fact that the...
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).
@ ROTF_HIDDEN
Bit number for hidden from construction.
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
@ TRACKDIR_BIT_Y_SE
Track y-axis, direction south-east.
static Foundation GetRoadFoundation(Slope tileh, RoadBits bits)
Get the foundationtype of a RoadBits Slope combination.
void MakeRoadDepot(Tile tile, Owner owner, DepotID depot_id, DiagDirection dir, RoadType rt)
Make a road depot.
uint16_t max_speed
Maximum speed for vehicles travelling on this road type.
@ ROTSG_DEPOT
Optional: Depot images.
uint SlopeToSpriteOffset(Slope s)
Returns the Sprite offset for a given Slope.
int GetTileMaxPixelZ(TileIndex tile)
Get top height of the tile.
std::array< uint32_t, HZB_END > squared_town_zone_radius
UpdateTownRadius updates this given the house count.
struct RailTypeInfo::@23 base_sprites
Struct containing the main sprites.
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_BASE.
void DrawRoadTypeCatenary(const TileInfo *ti, RoadType rt, RoadBits rb)
Draws the catenary for the RoadType of the given tile.
bool crossing_with_competitor
allow building of level crossings with competitor roads or rails
void MakeRoadNormal(Tile t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
Make a normal road tile.
void DrawRailCatenary(const TileInfo *ti)
Draws overhead wires and pylons for electric railways.
void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32_t total_offset, uint32_t newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence on tile with railroad specifics.
Axis GetCrossingRailAxis(Tile t)
Get the rail axis of a level crossing.
@ TRACK_BIT_LOWER
Lower track.
bool RailNoLevelCrossings(RailType rt)
Test if a RailType disallows build of level crossings.
static debug_inline TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
@ RATING_ROAD_DOWN_STEP_INNER
removing a roadpiece in the middle
StringID owner_type[4]
Type of each owner.
TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
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.
int x
X position of the tile in unit coordinates.
static uint GetRoadSpriteOffset(Slope slope, RoadBits bits)
Get the sprite offset within a spritegroup.
static Date date
Current date in days (day counter).
RoadBits MirrorRoadBits(RoadBits r)
Calculate the mirrored RoadBits.
TileIndex tile
Tile index.
static const RoadBits _invalid_tileh_slopes_road[2][15]
Invalid RoadBits on slopes.
ConstructionSettings construction
construction of things in-game
RoadBits GetAllRoadBits(Tile tile)
Get all set RoadBits on the given tile.
@ ROADSIDE_PAVED
Road with paved sidewalks.
Slope SlopeWithOneCornerRaised(Corner corner)
Returns the slope with a specific corner raised.
bool IsAnyRoadStop(Tile t)
Is the station at t a road station?
uint16_t rail_speed
Speed limit of rail (bridges and track)
@ MAX_COMPANIES
Maximum number of companies.
uint8_t GetSnowLine()
Get the current snow line, either variable or static.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
VehicleType type
Type of vehicle.
TrackdirBits
Allow incrementing of Trackdir variables.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
StringID tramtype
Type of tram on the tile.
T * First() const
Get the first vehicle in the chain.
SpriteID crossing
level crossing, rail in X direction
RoadTypes _roadtypes_type
Bitmap of road/tram types.
@ TUNNELBRIDGE_REMOVE
Removal of a tunnel or bridge owned by the towb.
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.
bool IsSlopeWithOneCornerRaised(Slope s)
Tests if a specific slope has exactly one corner raised.
@ RVSB_IN_DEPOT
The vehicle is in a depot.
constexpr T ClrBit(T &x, const uint8_t y)
Clears a bit in a variable.
bool IsTileOwner(Tile tile, Owner owner)
Checks if a tile belongs to the given owner.
TropicZone GetTropicZone(Tile tile)
Get the tropic zone.
#define CLRBITS(x, y)
Clears several bits in a variable.
Axis OtherAxis(Axis a)
Select the other axis as provided.
@ ROTSG_CATENARY_BACK
Optional: Catenary back.
TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
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.
@ ZOOM_LVL_DETAIL
All zoom levels below or equal to this will result in details on the screen, like road-work,...
std::tuple< Slope, int > GetTileSlopeZ(TileIndex tile)
Return the slope of a given tile inside the map.
CommandCost CmdBuildRoadDepot(DoCommandFlag flags, TileIndex tile, RoadType rt, DiagDirection dir)
Build a road depot.
static debug_inline bool IsRoadDepot(Tile t)
Return whether a tile is a road depot.
@ ROAD_X
Full road along the x-axis (south-west + north-east)
static const SpriteID SPR_ONEWAY_BASE
One way road sprites.
SpriteID single_y
single piece of rail in Y direction, without ground
RoadBits AxisToRoadBits(Axis a)
Create the road-part which belongs to the given Axis.
VehicleEnterTileStatus
The returned bits of VehicleEnterTile.
@ DRD_NORTHBOUND
All northbound traffic is disallowed.
CommandCost TunnelBridgeIsFree(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
Finds vehicle in tunnel / bridge.
bool IsDriveThroughStopTile(Tile t)
Is tile t a drive through road stop station or waypoint?
bool HasRoadCatenary(RoadType roadtype)
Test if a road type has catenary.
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
bool IsOnSnow(Tile t)
Check if a road tile has snow/desert.
static debug_inline bool IsRoadDepotTile(Tile t)
Return whether a tile is a road depot tile.
Money RoadConvertCost(RoadType from, RoadType to)
Calculates the cost of road conversion.
SpriteID GetCustomRailSprite(const RailTypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
@ TRACKDIR_BIT_X_SW
Track x-axis, direction south-west.
static const SpriteID SPR_TRAMWAY_BASE
Tramway sprites.
@ VETSB_ENTERED_WORMHOLE
The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/...
DiagDirection GetTunnelBridgeDirection(Tile t)
Get the direction pointing to the other end.
bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slope tileh_new, DiagDirection entrance)
Autoslope check for tiles with an entrance on an edge.
@ EXPENSES_CONSTRUCTION
Construction costs.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.