|
OpenTTD Source
14.0-beta3
|
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;
1010 bool under_tunnelbridge =
false;
1016 under_tunnelbridge = !under_tunnelbridge;
1017 }
else if (!under_tunnelbridge) {
1021 if (!is_ai && start_tile != end_tile) {
1038 if (is_ai)
return last_error;
1039 if (had_success)
break;
1062 if (tile == end_tile)
break;
1067 return had_success ? cost : last_error;
1093 if (start_tile > end_tile || (start_tile == end_tile && start_half)) {
1094 std::swap(start_tile, end_tile);
1095 std::swap(start_half, end_half);
1099 Money money_spent = 0;
1102 bool had_success =
false;
1112 RoadTramType rtt = GetRoadTramType(rt);
1117 if (money_spent > 0 && money_spent > money_available) {
1127 case STR_ERROR_OWNED_BY:
1128 case STR_ERROR_LOCAL_AUTHORITY_REFUSES_TO_ALLOW_THIS:
1136 if (tile == end_tile)
break;
1141 return { had_success ? cost : last_error, 0 };
1166 cost.
AddCost(_price[PR_BUILD_FOUNDATION]);
1170 bool rotate_existing_depot =
false;
1171 if (
IsRoadDepotTile(tile) && (HasRoadTypeTram(tile) ? rt == GetRoadTypeTram(tile) : rt == GetRoadTypeRoad(tile)))
1174 if (ret.
Failed())
return ret;
1179 if (ret.
Failed())
return ret;
1181 rotate_existing_depot =
true;
1184 if (!rotate_existing_depot) {
1186 if (cost.
Failed())
return cost;
1194 if (rotate_existing_depot) {
1209 cost.
AddCost(_price[PR_BUILD_DEPOT_ROAD]);
1217 if (ret.
Failed())
return ret;
1221 if (ret.
Failed())
return ret;
1227 RoadType rt = GetRoadTypeRoad(tile);
1233 delete Depot::GetByTile(tile);
1234 DoClearSquare(tile);
1249 for (RoadTramType rtt : _roadtramtypes) {
1253 if (tmp_ret.
Failed())
return tmp_ret;
1268 for (RoadTramType rtt : { RTT_TRAM, RTT_ROAD }) {
1272 if (tmp_ret.
Failed())
return tmp_ret;
1287 return RemoveRoadDepot(tile, flags);
1329 const byte _road_sloped_sprites[14] = {
1350 default: NOT_REACHED();
1353 static const uint offsets[] = {
1359 return offsets[bits];
1402 RoadType rt_road = GetRoadTypeRoad(neighbour);
1403 RoadType rt_tram = GetRoadTypeTram(neighbour);
1412 if (
CountBits(rb_new) >= 2) rb = rb_new;
1419 if (front != 0 || back != 0) {
1423 back = SPR_TRAMWAY_BACK_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1424 front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1439 static const int INF = 1000;
1440 static const SubSprite west = { -INF, -INF, -12, INF };
1441 static const SubSprite north = { -12, -INF, 12, INF };
1442 static const SubSprite east = { 12, -INF, INF, INF };
1443 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 16, 1, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 15, 0,
GetSlopePixelZInCorner(ti->
tileh, CORNER_W), &west);
1444 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 1, 1, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 0,
GetSlopePixelZInCorner(ti->
tileh, CORNER_N), &north);
1445 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 1, 16, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 15,
GetSlopePixelZInCorner(ti->
tileh, CORNER_E), &east);
1449 AddSortableSpriteToDraw(front, pal, ti->
x, ti->
y, 16, 16, z_wires + 1, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 0, z_wires);
1488 rt = GetRoadTypeTram(ti->
tile);
1523 if (draw_underlay) {
1525 if (road_rti !=
nullptr) {
1526 if (road_rti->UsesOverlay()) {
1531 if (tram_rti->UsesOverlay()) {
1541 if (road_rti !=
nullptr) {
1542 if (road_rti->UsesOverlay()) {
1549 if (tram_rti !=
nullptr) {
1550 if (tram_rti->UsesOverlay()) {
1553 }
else if (road_rti !=
nullptr) {
1570 if (rti ==
nullptr || rti->UsesOverlay()) {
1585 SpriteID image = SPR_ROAD_Y + offset;
1593 default: image -= 19;
break;
1633 if (road_rti !=
nullptr) {
1641 oneway += SPR_ONEWAY_SLOPE_N_OFFSET;
1643 oneway += SPR_ONEWAY_SLOPE_S_OFFSET;
1669 if (height < minz)
return;
1680 bool is_transparent =
false;
1682 is_transparent =
true;
1685 is_transparent =
true;
1689 for (
const DrawRoadTileStruct *drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
1690 DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10, is_transparent);
1717 if (rti->UsesOverlay()) {
1718 SpriteID image = SPR_ROAD_Y + axis;
1727 default: image -= 19;
break;
1743 default: image += 4;
break;
1754 if (rti->UsesOverlay()) {
1762 uint adjacent_diagdirs = 0;
1766 SetBit(adjacent_diagdirs, dir);
1770 switch (adjacent_diagdirs) {
1795 }
else if (draw_pbs || tram_rti !=
nullptr || road_rti->UsesOverlay()) {
1822 bool default_gfx = relocation == 0;
1827 relocation = SPR_TRAMWAY_DEPOT_WITH_TRACK - SPR_ROAD_DEPOT;
1828 default_gfx =
false;
1831 relocation = SPR_TRAMWAY_DEPOT_NO_TRACK - SPR_ROAD_DEPOT;
1835 relocation -= SPR_ROAD_DEPOT;
1844 if (rti->UsesOverlay()) {
1872 bool default_gfx = relocation == 0;
1877 relocation = SPR_TRAMWAY_DEPOT_WITH_TRACK - SPR_ROAD_DEPOT;
1878 default_gfx =
false;
1881 relocation = SPR_TRAMWAY_DEPOT_NO_TRACK - SPR_ROAD_DEPOT;
1885 relocation -= SPR_ROAD_DEPOT;
1893 if (rti->UsesOverlay()) {
1895 if (ground != 0)
DrawSprite(ground + offset, PAL_NONE, x, y);
1896 }
else if (RoadTypeIsTram(rt)) {
1897 DrawSprite(SPR_TRAMWAY_OVERLAY + offset, PAL_NONE, x, y);
1915 TownID tid = INVALID_TOWN;
1918 if (town !=
nullptr) tid = town->
index;
1925 static int GetSlopePixelZ_Road(
TileIndex tile, uint x, uint y,
bool)
1950 static const Roadside _town_road_types[][2] = {
1958 static_assert(
lengthof(_town_road_types) == HZB_END);
1960 static const Roadside _town_road_types_2[][2] = {
1968 static_assert(
lengthof(_town_road_types_2) == HZB_END);
1971 static void TileLoop_Road(
TileIndex tile)
1993 HouseZonesBits grp = HZB_TOWN_EDGE;
2023 if (cur_rs == new_rs[0])
return;
2026 if (cur_rs == new_rs[1]) {
2046 if (old_rb != new_rb) {
2060 if (rt != GetRoadTypeRoad(tile)) {
2069 static bool ClickTile_Road(
TileIndex tile)
2078 static const TrackBits _road_trackbits[16] = {
2107 RoadTramType rtt = (RoadTramType)sub_mode;
2111 const uint drd_to_multiplier[
DRD_END] = { 0x101, 0x100, 0x1, 0x0 };
2129 red_signals = trackdirbits;
2161 static const StringID _road_tile_strings[] = {
2162 STR_LAI_ROAD_DESCRIPTION_ROAD,
2163 STR_LAI_ROAD_DESCRIPTION_ROAD,
2164 STR_LAI_ROAD_DESCRIPTION_ROAD,
2165 STR_LAI_ROAD_DESCRIPTION_ROAD_WITH_STREETLIGHTS,
2166 STR_LAI_ROAD_DESCRIPTION_ROAD,
2167 STR_LAI_ROAD_DESCRIPTION_TREE_LINED_ROAD,
2168 STR_LAI_ROAD_DESCRIPTION_ROAD,
2169 STR_LAI_ROAD_DESCRIPTION_ROAD,
2178 RoadType road_rt = GetRoadTypeRoad(tile);
2179 RoadType tram_rt = GetRoadTypeTram(tile);
2195 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING;
2206 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_VEHICLE_DEPOT;
2222 bool mixed_owners = (tram_owner !=
INVALID_OWNER && tram_owner != first_owner) || (rail_owner !=
INVALID_OWNER && rail_owner != first_owner);
2227 td->
owner[0] = rail_owner;
2229 td->
owner[1] = road_owner;
2231 td->
owner[2] = tram_owner;
2234 td->
owner[0] = first_owner;
2253 if (rv->frame == RVC_DEPOT_STOP_FRAME &&
2281 RoadType rt = GetRoadTypeRoad(tile);
2287 for (RoadTramType rtt : _roadtramtypes) {
2297 for (RoadTramType rtt : _roadtramtypes) {
2300 RoadType rt = GetRoadType(tile, rtt);
2304 Company::Get(old_owner)->infrastructure.road[rt] -= num_bits;
2345 if (bits == bits_copy) {
2360 default: NOT_REACHED();
2440 RoadTramType rtt = GetRoadTramType(to_type);
2443 CommandCost error =
CommandCost((rtt == RTT_TRAM) ? STR_ERROR_NO_SUITABLE_TRAMWAY : STR_ERROR_NO_SUITABLE_ROAD);
2444 bool found_convertible_road =
false;
2446 std::unique_ptr<TileIterator> iter = std::make_unique<OrthogonalTileIterator>(area_start, area_end);
2452 RoadType from_type = GetRoadType(tile, rtt);
2463 error.
MakeError(STR_ERROR_CROSSING_DISALLOWED_ROAD);
2504 if (rtt == RTT_ROAD && owner ==
OWNER_TOWN) {
2518 found_convertible_road =
true;
2545 if (endtile < tile) {
2557 if (rtt == RTT_ROAD && owner ==
OWNER_TOWN) {
2566 found_convertible_road =
true;
2602 return found_convertible_road ? cost : error;
2609 GetSlopePixelZ_Road,
2613 GetTileTrackStatus_Road,
2617 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.
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
@ ROTSG_ONEWAY
Optional: One-way indicator images.
@ SLOPE_SE
south and east corner are raised
@ 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-...
Direction ReverseDir(Direction d)
Return the reverse of a direction.
void StartRoadWorks(Tile t)
Start road works on a tile.
@ TRACK_BIT_NONE
No track.
@ ROADTYPE_END
Used for iterations.
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
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
Use this function to notify YAPF that track layout (or signal configuration) has change.
uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
Calculates the length of a tunnel or a bridge (without end tiles)
byte road_build_months
fund road reconstruction in action?
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.
TimerGameCalendar::Date introduction_date
Introduction date.
Foundation FlatteningFoundation(Slope s)
Returns the foundation needed to flatten a slope.
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.
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.
T * Next() const
Get next vehicle in the chain.
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 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.
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)
@ 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.
@ DIAGDIR_END
Used for iterations.
bool AutoslopeEnabled()
Tests if autoslope is enabled for _current_company.
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.
SpriteID build_depot
button for building depots
SpriteID sprite
The 'real' sprite.
int GetBridgeHeight(TileIndex t)
Get the height ('z') of a bridge.
@ SLOPE_ELEVATED
bit mask containing all 'simple' slopes
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.
This struct contains all the info that is needed to draw and construct tracks.
@ VETSB_CONTINUE
Bit sets of the above specified bits.
@ ROADSIDE_BARREN
Road on barren land.
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.
static const uint TILE_SIZE
Tile size in world coordinates.
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.
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.
byte _display_opt
What do we want to draw/do?
uint32_t road[ROADTYPE_END]
Count of company owned track bits for each road type.
CursorID tunnel
Cursor for building a tunnel.
@ TRACKDIR_BIT_Y_NW
Track y-axis, direction north-west.
@ VEH_ROAD
Road vehicle type.
struct RailTypeInfo::@26 strings
Strings associated with the rail type.
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
bool Chance16(const uint a, const uint b)
Flips a coin with given probability.
Owner
Enum for all companies/owners.
@ 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.
@ 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.
@ ROTSG_CURSORS
Optional: Cursor and toolbar icon images.
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.
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.
RoadBits GetCrossingRoadBits(Tile tile)
Get the road bits of a level crossing.
@ 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?
GameCreationSettings game_creation
settings used during the creation of a game (map)
@ TRACK_BIT_RIGHT
Right track.
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.
@ ROAD_X
Full road along the x-axis (south-west + north-east)
bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
Checks if an engine of the given RoadType got power on a tile with a given RoadType.
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.
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...
TimerGameCalendar::Date build_date
Date of construction of tile contents.
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.
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
Slope
Enumeration for the slope-type.
@ ROADSIDE_STREET_LIGHTS
Road with street lights on paved sidewalks.
@ 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
@ 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.
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.
@ ROAD_NE
North-east part.
bool IsBayRoadStopTile(Tile t)
Is tile t a bay (non-drive through) road stop station?
@ ROADSIDE_GRASS
Road on grass.
Money GetAvailableMoneyForCommand()
This functions returns the money which can be used to execute a command.
@ EXPENSES_CONSTRUCTION
Construction costs.
bool HasRoadCatenaryDrawn(RoadType roadtype)
Test if we should draw road catenary.
Common return value for all commands.
byte GetSnowLine()
Get the current snow line, either variable or static.
bool IsBridge(Tile t)
Checks if this is a bridge, instead of a tunnel.
void InitRoadTypes()
Resolve sprites of custom road types.
SoundSettings sound
sound effect settings
@ SLOPE_NE
north and east corner are raised
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)
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.
TileIndex tile
Current tile index.
bool MayHaveRoad(Tile t)
Test whether a tile can have road/tram types.
StringID roadtype
Type of road on the tile.
void ResetRoadTypes()
Reset all road type information to its default values.
TransportType
Available types of transport.
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.
@ INVALID_OWNER
An invalid owner.
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.
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.
@ ROADSIDE_PAVED
Road with paved sidewalks.
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.
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
@ 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.
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 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.
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
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.
@ ROADTYPE_ROAD
Basic road type.
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...
@ 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.
void SetDParamsForOwnedBy(Owner owner, TileIndex tile)
Set the right DParams for STR_ERROR_OWNED_BY.
@ TRACKDIR_X_NE
X-axis and direction to north-east.
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.
DiagDirection
Enumeration for diagonal directions.
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.
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.
TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
Builds a TrackStatus.
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.
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.
@ DRD_NONE
None of the directions are disallowed.
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 ...
@ DRD_SOUTHBOUND
All southbound traffic is disallowed.
Money RoadClearCost(RoadType roadtype)
Returns the cost of clearing the specified roadtype.
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.
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.
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.
uint16_t tram_speed
Speed limit of tram (bridges and track)
SpriteID build_x_road
button for building single rail in X direction
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.
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
@ DRD_BOTH
All directions are disallowed.
@ 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.
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.
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
bool IsValidDisallowedRoadDirections(DisallowedRoadDirections drt)
Checks if a DisallowedRoadDirections is valid.
@ TRAMWAY_REPLACE_DEPOT_WITH_TRACK
Electrified depot graphics with tram track were loaded.
Slope GetTilePixelSlope(TileIndex tile, int *h)
Return the slope of a given tile.
TileType
The different types of tiles.
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.
@ TRACKDIR_Y_NW
Y-axis and direction to north-west.
@ SLOPE_SW
south and west corner are raised
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.
@ OWNER_NONE
The tile has no ownership.
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.
bool IsRoadStop(Tile t)
Is the station at t a road station?
@ 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_BEGIN
Used for iterations.
RoadType
The different roadtypes we support.
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.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
bool IsBridgeAbove(Tile t)
checks if a bridge is set above the ground of this tile
StringID str
Description of the tile.
@ 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.
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.
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).
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
@ ROTF_HIDDEN
Bit number for hidden from construction.
TrackBits
Allow incrementing of Track variables.
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.
@ ROAD_NW
North-west part.
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.
@ ROAD_SW
South-west part.
#define lengthof(x)
Return the length of an fixed size array.
@ ROTSG_DEPOT
Optional: Depot images.
@ ROAD_NONE
No road-part is build.
uint SlopeToSpriteOffset(Slope s)
Returns the Sprite offset for a given Slope.
@ ROAD_SE
South-east part.
int GetTileMaxPixelZ(TileIndex tile)
Get top height of the tile.
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_LVL_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.
@ TRANSPORT_ROAD
Transport by road vehicle.
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.
@ TRACK_BIT_Y
Y-axis track.
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.
Slope SlopeWithOneCornerRaised(Corner corner)
Returns the slope with a specific corner raised.
uint16_t rail_speed
Speed limit of rail (bridges and track)
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.
@ TRACKDIR_X_SW
X-axis and direction to south-west.
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.
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.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
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.
@ OWNER_WATER
The tile/execution is done by "water".
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.
@ ROADTYPE_BEGIN
Used for iterations.
TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
uint ApplyPixelFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
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 debug_inline bool IsRoadDepot(Tile t)
Return whether a tile is a road depot.
static const SpriteID SPR_ONEWAY_BASE
One way road sprites.
uint32_t squared_town_zone_radius[HZB_END]
UpdateTownRadius updates this given the house count.
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.
@ 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.
bool IsDriveThroughStopTile(Tile t)
Is tile t a drive through road stop station?
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
@ ROADSIDE_GRASS_ROAD_WORKS
Road on grass with road works.
bool IsOnSnow(Tile t)
Check if a road tile has snow/desert.
uint32_t rail[RAILTYPE_END]
Count of company owned track bits for each rail type.
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.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.