Go to the documentation of this file.
41 #include "table/strings.h"
50 std::vector<RoadType> _sorted_roadtypes;
72 { 0, 0, 0, 0, 0, 0, 0, 0, 0, {}, {}, 0, {}, {} },
76 for (; i <
lengthof(_roadtypes); i++) _roadtypes[i] = empty_roadtype;
85 if (cursors_base != 0) {
109 if (RoadTypeIsRoad(first) == RoadTypeIsRoad(second)) {
112 return RoadTypeIsTram(first) < RoadTypeIsTram(second);
122 ResolveRoadTypeGUISprites(rti);
126 _sorted_roadtypes.clear();
128 if (_roadtypes[rt].label != 0 && !
HasBit(_roadtypes_hidden_mask, rt)) {
129 _sorted_roadtypes.push_back(rt);
132 std::sort(_sorted_roadtypes.begin(), _sorted_roadtypes.end(),
CompareRoadTypes);
143 if (rti->
label == 0) {
166 if (rtt == RTT_TRAM) {
199 if (c ==
nullptr)
return;
294 if (ret.
Failed())
return ret;
341 if (ret.
Failed())
return ret;
349 if (ret.
Failed())
return ret;
356 if (ret.
Failed())
return ret;
365 if (ret.
Failed())
return ret;
441 if (pieces ==
ROAD_NONE)
return_cmd_error((rtt == RTT_TRAM) ? STR_ERROR_THERE_IS_NO_TRAMWAY : STR_ERROR_THERE_IS_NO_ROAD);
564 RoadBits type_bits = existing | *pieces;
577 type_bits = existing | *pieces;
626 p2 = (town !=
nullptr) ? town->
index : INVALID_TOWN;
638 RoadBits pieces = Extract<RoadBits, 0, 4>(p1);
643 RoadType rt = Extract<RoadType, 4, 6>(p1);
649 RoadTramType rtt = GetRoadTramType(rt);
651 bool need_to_clear =
false;
658 other_bits =
GetRoadBits(tile, OtherRoadTramType(rtt));
667 if ((existing & pieces) == pieces) {
669 if (toggle_drd !=
DRD_NONE && rtt == RTT_ROAD) {
675 if (ret.
Failed())
return ret;
687 if (ret.
Failed())
return ret;
705 if (ret.
Failed())
return ret;
727 default: NOT_REACHED();
754 if (pieces &
ROAD_X)
goto do_clear;
759 if (pieces &
ROAD_Y)
goto do_clear;
763 default:
goto do_clear;
767 if (ret.
Failed())
return ret;
798 if (pieces & ~curbits)
goto do_clear;
812 if (ret.
Failed())
return ret;
818 need_to_clear =
true;
825 if (ret.
Failed())
return ret;
829 if (other_bits != pieces) {
840 if (!need_to_clear) {
859 if (ret.
Failed())
return ret;
865 RoadType existing_rt = GetRoadType(tile, rtt);
871 if (ret.
Failed())
return ret;
958 RoadTramType rtt = GetRoadTramType(rt);
959 RoadType existing = GetRoadType(tile, rtt);
991 RoadType rt = Extract<RoadType, 3, 6>(p2);
994 Axis axis = Extract<Axis, 2, 1>(p2);
1002 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
1018 bool had_bridge =
false;
1019 bool had_tunnel =
false;
1020 bool had_success =
false;
1021 bool is_ai =
HasBit(p2, 11);
1028 if (!is_ai && start_tile != end_tile) {
1045 if (is_ai)
return last_error;
1068 if (tile == end_tile)
break;
1073 return had_success ? cost : last_error;
1096 RoadType rt = Extract<RoadType, 3, 6>(p2);
1099 Axis axis = Extract<Axis, 2, 1>(p2);
1105 if (start_tile > end_tile || (start_tile == end_tile &&
HasBit(p2, 0))) {
1107 start_tile = end_tile;
1113 Money money_spent = 0;
1116 bool had_success =
false;
1126 RoadTramType rtt = GetRoadTramType(rt);
1131 if (money_spent > 0 && money_spent > money_available) {
1135 RemoveRoad(tile, flags, bits, rtt,
true,
false);
1141 if (last_error.
GetErrorMessage() != STR_ERROR_OWNED_BY) last_error = ret;
1145 if (tile == end_tile)
break;
1150 return had_success ? cost : last_error;
1170 RoadType rt = Extract<RoadType, 2, 6>(p1);
1180 cost.
AddCost(_price[PR_BUILD_FOUNDATION]);
1184 if (cost.
Failed())
return cost;
1201 cost.
AddCost(_price[PR_BUILD_DEPOT_ROAD]);
1209 if (ret.
Failed())
return ret;
1213 if (ret.
Failed())
return ret;
1219 RoadType rt = GetRoadTypeRoad(tile);
1225 delete Depot::GetByTile(tile);
1226 DoClearSquare(tile);
1241 FOR_ALL_ROADTRAMTYPES(rtt) {
1245 if (tmp_ret.
Failed())
return tmp_ret;
1260 for (RoadTramType rtt : { RTT_TRAM, RTT_ROAD }) {
1264 if (tmp_ret.
Failed())
return tmp_ret;
1279 return RemoveRoadDepot(tile, flags);
1321 const byte _road_sloped_sprites[14] = {
1342 default: NOT_REACHED();
1345 static const uint offsets[] = {
1351 return offsets[bits];
1394 RoadType rt_road = GetRoadTypeRoad(neighbour);
1395 RoadType rt_tram = GetRoadTypeTram(neighbour);
1404 if (
CountBits(rb_new) >= 2) rb = rb_new;
1411 if (front != 0 || back != 0) {
1415 back = SPR_TRAMWAY_BACK_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1416 front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->
tileh - 1];
1431 static const int INF = 1000;
1432 static const SubSprite west = { -INF, -INF, -12, INF };
1433 static const SubSprite north = { -12, -INF, 12, INF };
1434 static const SubSprite east = { 12, -INF, INF, INF };
1435 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 16, 1, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 15, 0,
GetSlopePixelZInCorner(ti->
tileh, CORNER_W), &west);
1436 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 1, 1, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 0,
GetSlopePixelZInCorner(ti->
tileh, CORNER_N), &north);
1437 AddSortableSpriteToDraw(back, pal, ti->
x, ti->
y, 1, 16, z_wires, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 15,
GetSlopePixelZInCorner(ti->
tileh, CORNER_E), &east);
1441 AddSortableSpriteToDraw(front, pal, ti->
x, ti->
y, 16, 16, z_wires + 1, ti->
z,
IsTransparencySet(
TO_CATENARY), 0, 0, z_wires);
1480 rt = GetRoadTypeTram(ti->
tile);
1515 if (road_rti !=
nullptr) {
1516 if (road_rti->UsesOverlay()) {
1521 if (tram_rti->UsesOverlay()) {
1530 if (road_rti !=
nullptr) {
1531 if (road_rti->UsesOverlay()) {
1538 if (tram_rti !=
nullptr) {
1539 if (tram_rti->UsesOverlay()) {
1542 }
else if (road_rti !=
nullptr) {
1559 if (rti ==
nullptr || rti->UsesOverlay()) {
1574 SpriteID image = SPR_ROAD_Y + offset;
1582 default: image -= 19;
break;
1622 if (road_rti !=
nullptr) {
1648 if (height < minz)
return;
1658 for (
const DrawRoadTileStruct *drts = _road_display_table[roadside][road | tram]; drts->image != 0; drts++) {
1659 DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10, is_transparent);
1686 if (rti->UsesOverlay()) {
1687 SpriteID image = SPR_ROAD_Y + axis;
1696 default: image -= 19;
break;
1712 default: image += 4;
break;
1723 if (rti->UsesOverlay()) {
1729 }
else if (draw_pbs || tram_rti !=
nullptr || road_rti->UsesOverlay()) {
1756 bool default_gfx = relocation == 0;
1761 relocation = SPR_TRAMWAY_DEPOT_WITH_TRACK - SPR_ROAD_DEPOT;
1762 default_gfx =
false;
1765 relocation = SPR_TRAMWAY_DEPOT_NO_TRACK - SPR_ROAD_DEPOT;
1769 relocation -= SPR_ROAD_DEPOT;
1778 if (rti->UsesOverlay()) {
1806 bool default_gfx = relocation == 0;
1811 relocation = SPR_TRAMWAY_DEPOT_WITH_TRACK - SPR_ROAD_DEPOT;
1812 default_gfx =
false;
1815 relocation = SPR_TRAMWAY_DEPOT_NO_TRACK - SPR_ROAD_DEPOT;
1819 relocation -= SPR_ROAD_DEPOT;
1827 if (rti->UsesOverlay()) {
1829 if (ground != 0)
DrawSprite(ground + offset, PAL_NONE, x, y);
1830 }
else if (RoadTypeIsTram(rt)) {
1831 DrawSprite(SPR_TRAMWAY_OVERLAY + offset, PAL_NONE, x, y);
1849 TownID tid = INVALID_TOWN;
1852 if (town !=
nullptr) tid = town->
index;
1859 static int GetSlopePixelZ_Road(
TileIndex tile, uint x, uint y)
1884 static const Roadside _town_road_types[][2] = {
1892 static const Roadside _town_road_types_2[][2] = {
1901 static void TileLoop_Road(
TileIndex tile)
1923 HouseZonesBits grp = HZB_TOWN_EDGE;
1953 if (cur_rs == new_rs[0])
return;
1956 if (cur_rs == new_rs[1]) {
1976 if (old_rb != new_rb) {
1990 if (rt != GetRoadTypeRoad(tile)) {
1999 static bool ClickTile_Road(
TileIndex tile)
2008 static const TrackBits _road_trackbits[16] = {
2037 RoadTramType rtt = (RoadTramType)sub_mode;
2041 const uint drd_to_multiplier[
DRD_END] = { 0x101, 0x100, 0x1, 0x0 };
2080 static const StringID _road_tile_strings[] = {
2081 STR_LAI_ROAD_DESCRIPTION_ROAD,
2082 STR_LAI_ROAD_DESCRIPTION_ROAD,
2083 STR_LAI_ROAD_DESCRIPTION_ROAD,
2084 STR_LAI_ROAD_DESCRIPTION_ROAD_WITH_STREETLIGHTS,
2085 STR_LAI_ROAD_DESCRIPTION_ROAD,
2086 STR_LAI_ROAD_DESCRIPTION_TREE_LINED_ROAD,
2087 STR_LAI_ROAD_DESCRIPTION_ROAD,
2088 STR_LAI_ROAD_DESCRIPTION_ROAD,
2097 RoadType road_rt = GetRoadTypeRoad(tile);
2098 RoadType tram_rt = GetRoadTypeTram(tile);
2114 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_RAIL_LEVEL_CROSSING;
2125 td->
str = STR_LAI_ROAD_DESCRIPTION_ROAD_VEHICLE_DEPOT;
2141 bool mixed_owners = (tram_owner !=
INVALID_OWNER && tram_owner != first_owner) || (rail_owner !=
INVALID_OWNER && rail_owner != first_owner);
2146 td->
owner[0] = rail_owner;
2148 td->
owner[1] = road_owner;
2150 td->
owner[2] = tram_owner;
2153 td->
owner[0] = first_owner;
2172 if (rv->frame == RVC_DEPOT_STOP_FRAME &&
2200 RoadType rt = GetRoadTypeRoad(tile);
2206 FOR_ALL_ROADTRAMTYPES(rtt) {
2216 FOR_ALL_ROADTRAMTYPES(rtt) {
2219 RoadType rt = GetRoadType(tile, rtt);
2223 Company::Get(old_owner)->infrastructure.road[rt] -= num_bits;
2264 if (bits == bits_copy) {
2279 default: NOT_REACHED();
2355 RoadType to_type = Extract<RoadType, 0, 6>(p2);
2364 RoadTramType rtt = GetRoadTramType(to_type);
2368 bool found_convertible_road =
false;
2376 RoadType from_type = GetRoadType(tile, rtt);
2387 error.MakeError(STR_ERROR_CROSSING_DISALLOWED_ROAD);
2428 if (rtt == RTT_ROAD && owner ==
OWNER_TOWN) {
2429 error.MakeError(STR_ERROR_OWNED_BY);
2442 found_convertible_road =
true;
2469 if (endtile < tile) {
2481 if (rtt == RTT_ROAD && owner ==
OWNER_TOWN) {
2482 error.MakeError(STR_ERROR_OWNED_BY);
2490 found_convertible_road =
true;
2527 return found_convertible_road ? cost :
error;
2534 GetSlopePixelZ_Road,
2538 GetTileTrackStatus_Road,
2542 ChangeTileOwner_Road,
static void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence in GUI with railroad specifics.
RoadTypeFlags flags
Bit mask of road type flags.
@ EV_BULLDOZER
Bulldozer at roadworks.
static void DrawRoadBits(TileInfo *ti)
Draw ground sprite and road pieces.
Buses, trucks and trams belong to this class.
static bool RailNoLevelCrossings(RailType rt)
Test if a RailType disallows build of level crossings.
static bool HasTownOwnedRoad(TileIndex t)
Checks if given tile has town owned road.
static DiagDirection GetRoadDepotDirection(TileIndex t)
Get the direction of the exit of a road depot.
uint32 TileIndex
The index/ID of a Tile.
@ 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-...
struct RoadTypeInfo::@42 gui_sprites
struct containing the sprites for the road GUI.
SpriteID single_x
single piece of rail in X direction, without ground
@ TRACK_BIT_NONE
No track.
Cheat magic_bulldozer
dynamite industries, objects
uint16 max_speed
Maximum speed for vehicles travelling on this rail type.
static bool Chance16(const uint a, const uint b)
Flips a coin with given probability.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
static Titem * Get(size_t index)
Returns Titem with given index.
static const RoadTypeInfo _original_roadtypes[]
Global Roadtype definition.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
static bool IsRoadStop(TileIndex t)
Is the station at t a road station?
static bool HasAtMostOneBit(T value)
Test whether value has at most 1 bit set.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
@ ROTF_CATENARY
Bit number for adding catenary.
void DrawRoadOverlays(const TileInfo *ti, PaletteID pal, const RoadTypeInfo *road_rti, const RoadTypeInfo *tram_rti, uint road_offset, uint tram_offset)
Draw road underlay and overlay sprites.
SpriteID build_y_road
button for building single rail in Y direction
TrackdirBits
Enumeration of bitmasks for the TrackDirs.
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
Use this function to notify YAPF that track layout (or signal configuration) has change.
byte road_build_months
fund road reconstruction in action?
uint x
X position of the tile in unit coordinates.
struct RoadTypeInfo::@44 strings
Strings associated with the rail type.
static Vehicle * UpdateRoadVehPowerProc(Vehicle *v, void *data)
Update power of road vehicle under which is the roadtype being converted.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
static bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slope tileh_new, DiagDirection entrance)
Autoslope check for tiles with an entrance on an edge.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
@ TO_BUILDINGS
company buildings - depots, stations, HQ, ...
Tile information, used while rendering the tile.
@ ROAD_TILE_CROSSING
Level crossing.
byte landscape
the landscape we're currently in
StringID railtype
Type of rail on the tile.
RoadTypes introduces_roadtypes
Bitmask of which other roadtypes are introduced when this roadtype is introduced.
static bool IsTransparencySet(TransparencyOption to)
Check if the transparency option bit is set and if we aren't in the game menu (there's never transpar...
T * Next() const
Get next vehicle in the chain.
@ TRANSPORT_RAIL
Transport by train.
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
CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a piece of road.
static Axis OtherAxis(Axis a)
Select the other axis as provided.
static void SetTrackReservation(TileIndex t, TrackBits b)
Sets the reserved track bits of the tile.
static const uint LEVELCROSSING_TRACKBIT_FACTOR
Multiplier for how many regular track bits a level crossing counts.
static SpriteID GetRoadGroundSprite(const TileInfo *ti, Roadside roadside, const RoadTypeInfo *rti, uint offset, PaletteID *pal)
Get ground sprite to draw for a road tile.
@ INVALID_ROADTYPE
flag for invalid roadtype
@ RTSG_CROSSING
Level crossing overlay images.
static Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
@ ROAD_SW
South-west part.
static bool IsRoadDepotTile(TileIndex t)
Return whether a tile is a road depot tile.
static Money RoadConvertCost(RoadType from, RoadType to)
Calculates the cost of road conversion.
@ DIAGDIR_END
Used for iterations.
uint32 squared_town_zone_radius[HZB_END]
UpdateTownRadius updates this given the house count.
Tindex index
Index of this pool item.
void DrawRoadCatenary(const TileInfo *ti)
Draws the catenary for the given tile.
static TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
SpriteID build_depot
button for building depots
SpriteID sprite
The 'real' sprite.
int GetBridgeHeight(TileIndex t)
Get the height ('z') of a bridge.
SpriteID single_y
single piece of rail in Y direction, without ground
static T KillFirstBit(T value)
Clear the first bit in an integer.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
uint16 tram_speed
Speed limit of tram (bridges and track)
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
RoadTileType
The different types of road tiles.
This struct contains all the info that is needed to draw and construct tracks.
@ ROAD_X
Full road along the x-axis (south-west + north-east)
bool include(std::vector< T > &vec, const T &item)
Helper function to append an item to a vector if it is not already contained Consider using std::set,...
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
@ VETSB_CONTINUE
Bit sets of the above specified bits.
@ ROADSIDE_BARREN
Road on barren land.
static bool IsStandardRoadStopTile(TileIndex t)
Is tile t a standard (non-drive through) road stop station?
static const uint BB_HEIGHT_UNDER_BRIDGE
Some values for constructing bounding boxes (BB).
static void SetCrossingReservation(TileIndex t, bool b)
Set the reservation state of the rail crossing.
static void SetRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
Set the owner of a specific road type.
uint GetPartialPixelZ(int x, int y, Slope corners)
Determines height at given coordinate of a slope.
static bool IsDriveThroughStopTile(TileIndex t)
Is tile t a drive through road stop station?
static const uint TILE_SIZE
Tile size in world coordinates.
@ ROADTYPE_END
Used for iterations.
void DrawBridgeMiddle(const TileInfo *ti)
Draw the middle bits of a bridge.
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
Draw the road depot sprite.
uint y
Y position of the tile in unit coordinates.
ClientSettings _settings_client
The current settings for this game.
void VehicleEnterDepot(Vehicle *v)
Vehicle entirely entered the depot, update its status, orders, vehicle windows, service it,...
TileIndex xy
town center tile
@ DC_NO_WATER
don't allow building on water
static uint TileY(TileIndex tile)
Get the Y component of a tile.
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
static const uint32 VALID_LEVEL_CROSSING_SLOPES
Constant bitset with safe slopes for building a level crossing.
static int GetSlopePixelZInCorner(Slope tileh, Corner corner)
Determine the Z height of a corner relative to TileZ.
static RoadBits GetCrossingRoadBits(TileIndex tile)
Get the road bits of a level crossing.
byte _display_opt
What do we want to draw/do?
static void SetRoadBits(TileIndex t, RoadBits r, RoadTramType rtt)
Set the present road bits for a specific road type.
static void StartRoadWorks(TileIndex t)
Start road works on a tile.
CursorID tunnel
Cursor for building a tunnel.
TransportType
Available types of transport.
@ VEH_ROAD
Road vehicle type.
Date introduction_date
Introduction date.
@ ROADTYPE_ROAD
Basic road type.
static void TerminateRoadWorks(TileIndex t)
Terminate road works on a tile.
Owner
Enum for all companies/owners.
@ DC_EXEC
execute the given command
Used to only draw a part of the sprite.
CommandCost CheckforTownRating(DoCommandFlag flags, Town *t, TownRatingCheckType type)
Does the town authority allow the (destructive) action of the current company?
@ MP_ROAD
A tile with road (or tram tracks)
StringID GetErrorMessage() const
Returns the error message of a command.
CursorID depot
Cursor for building a depot.
Tile description for the 'land area information' tool.
static bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
Find out if the slope of the tile is suitable to build a depot of given direction.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
static Corner GetHighestSlopeCorner(Slope s)
Returns the highest corner of a slope (one corner raised or a steep slope).
@ ROTSG_CURSORS
Optional: Cursor and toolbar icon images.
static Track GetCrossingRailTrack(TileIndex tile)
Get the rail track of a level crossing.
DoCommandFlag
List of flags for a command.
@ TRACKDIR_Y_SE
Y-axis and direction to south-east.
Foundation
Enumeration for Foundations.
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
CommandCost EnsureNoVehicleOnGround(TileIndex tile)
Ensure there is no vehicle at the ground at the given position.
CursorID road_nwse
Cursor for building rail in Y direction.
CursorID road_swne
Cursor for building rail in X direction.
static Foundation FlatteningFoundation(Slope s)
Returns the foundation needed to flatten a slope.
static bool IsStraightRoad(RoadBits r)
Check if we've got a straight road.
@ TRACK_BIT_UPPER
Upper track.
bool Succeeded() const
Did this command succeed?
static uint SlopeToSpriteOffset(Slope s)
Returns the Sprite offset for a given Slope.
static uint TileX(TileIndex tile)
Get the X component of a tile.
static TrackBits GetRailReservationTrackBits(TileIndex t)
Returns the reserved track bits of the tile.
static RoadBits DiagDirToRoadBits(DiagDirection d)
Create the road-part which belongs to the given DiagDirection.
std::vector< RoadTypeLabel > RoadTypeLabelList
List of road type labels.
static uint CountBits(T value)
Counts the number of set bits in a variable.
GameCreationSettings game_creation
settings used during the creation of a game (map)
@ TRACK_BIT_RIGHT
Right track.
static bool IncreaseRoadWorksCounter(TileIndex t)
Increase the progress counter of road works.
static bool CompareRoadTypes(const RoadType &first, const RoadType &second)
Compare roadtypes based on their sorting order.
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
@ SLOPE_NW
north and west corner are raised
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
Slope tileh
Slope of the tile.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
static RoadBits AxisToRoadBits(Axis a)
Create the road-part which belongs to the given Axis.
bool ambient
Play ambient, industry and town sounds.
StringID name
Name of this rail type.
Date build_date
Date of construction of tile contents.
@ TRANSPORT_ROAD
Transport by road vehicle.
RoadBits
Enumeration for the road parts on a tile.
PalSpriteID ground
Palette and sprite for the ground.
static void SetTunnelBridgeOwner(TileIndex begin, TileIndex end, Owner owner)
Sets the ownership of the bridge/tunnel ramps.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
@ ROAD_NONE
No road-part is build.
Roadside
The possible road side decorations.
static bool DrawRoadAsSnowDesert(TileIndex tile, Roadside roadside)
Should the road be drawn as a unpaved snow/desert road? By default, roads are always drawn as unpaved...
static RoadBits GetAllRoadBits(TileIndex tile)
Get all set RoadBits on the given tile.
SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
bool RoadVehiclesAreBuilt()
Verify whether a road vehicle is available.
@ ROAD_TILE_NORMAL
Normal road.
@ DRD_NORTHBOUND
All northbound traffic is disallowed.
static RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
Get the present road bits for a specific road type.
@ ROADSIDE_STREET_LIGHTS
Road with street lights on paved sidewalks.
Iterator to iterate over a tile area (rectangle) of the map.
uint DistanceManhattan(TileIndex t0, TileIndex t1)
Gets the Manhattan distance between the two given tiles.
static int GetSlopeMaxZ(Slope s)
Returns the height of the highest corner of a slope relative to TileZ (= minimal height)
static void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence on tile with railroad specifics.
@ VS_HIDDEN
Vehicle is not visible.
RoadTypes powered_roadtypes
bitmask to the OTHER roadtypes on which a vehicle of THIS roadtype generates power
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
@ FOUNDATION_INCLINED_Y
The tile has an along Y-axis inclined foundation.
std::vector< RoadVehicle * > RoadVehicleList
Helper type for lists/vectors of road vehicles.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
static uint MapSize()
Get the size of the map.
@ ROADSIDE_GRASS
Road on grass.
@ EXPENSES_CONSTRUCTION
Construction costs.
static RoadBits ComplementRoadBits(RoadBits r)
Calculate the complement of a RoadBits value.
static bool IsSteepSlope(Slope s)
Checks if a slope is steep.
Common return value for all commands.
byte GetSnowLine()
Get the current snow line, either variable or static.
Date _date
Current date in days (day counter)
static bool HasGrfMiscBit(GrfMiscBit bit)
Check for grf miscellaneous bits.
void InitRoadTypes()
Resolve sprites of custom road types.
SoundSettings sound
sound effect settings
@ CMD_BUILD_ROAD
build a "half" road
@ ROTF_HIDDEN
Bit number for hidden from construction.
static Track AxisToTrack(Axis a)
Convert an Axis to the corresponding Track AXIS_X -> TRACK_X AXIS_Y -> TRACK_Y Uses the fact that the...
@ SLOPE_ELEVATED
bit mask containing all 'simple' slopes
RoadBits GetAnyRoadBits(TileIndex tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance)
Returns the RoadBits on an arbitrary tile Special behaviour:
static bool HasExactlyOneBit(T value)
Test whether value has exactly 1 bit set.
void DirtyCompanyInfrastructureWindows(CompanyID company)
Redraw all windows with company infrastructure counts.
Town * CalcClosestTownFromTile(TileIndex tile, uint threshold=UINT_MAX)
Return the town closest to the given tile within threshold.
@ DRD_NONE
None of the directions are disallowed.
static TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
Converts TrackBits to TrackdirBits while allowing both directions.
static RailTileType GetRailTileType(TileIndex t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
TileIndex tile
Current tile index.
static bool IsNormalRoad(TileIndex t)
Return whether a tile is a normal road.
static void ToggleSnow(TileIndex t)
Toggle the snow/desert state of a road tile.
@ CMD_REMOVE_LONG_ROAD
remove a complete road (not a "half" one)
Base class for tile iterators.
static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadTramType rtt, bool crossing_check, bool town_check=true)
Delete a piece of road.
StringID roadtype
Type of road on the tile.
void ResetRoadTypes()
Reset all road type information to its default values.
Cheats _cheats
All the cheats.
@ INVALID_OWNER
An invalid owner.
static void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadType road_rt, RoadType tram_rt, uint town)
Make a level crossing.
SpriteID auto_road
button for the autoroad construction
@ FOUNDATION_INCLINED_X
The tile has an along X-axis inclined foundation.
CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a long piece of road.
static bool IsRoadOwner(TileIndex t, RoadTramType rtt, Owner o)
Check if a specific road type is owned by an owner.
bool Failed() const
Did this command fail?
bool mod_road_rebuild
roadworks remove unnecessary RoadBits
struct RoadTypeInfo::@43 cursor
Cursors associated with the road type.
static Roadside GetRoadside(TileIndex tile)
Get the decorations of a road.
static bool IsInvisibilitySet(TransparencyOption to)
Check if the invisibility option bit is set and if we aren't in the game menu (there's never transpar...
@ ROADSIDE_PAVED
Road with paved sidewalks.
static bool HasRoadCatenaryDrawn(RoadType roadtype)
Test if we should draw road catenary.
TileIndex GetNorthernBridgeEnd(TileIndex t)
Finds the northern end of a bridge starting at a middle tile.
void GetNameOfOwner(Owner owner, TileIndex tile)
Set the right DParams to get the name of an owner.
Represents the covered area of e.g.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
static const uint TUNNELBRIDGE_TRACKBIT_FACTOR
Multiplier for how many regular track bits a tunnel/bridge counts.
static bool HasTileRoadType(TileIndex t, RoadTramType rtt)
Check if a tile has a road or a tram road type.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
static TropicZone GetTropicZone(TileIndex tile)
Get the tropic zone.
RoadTypeLabelList alternate_labels
Road type labels this type provides in addition to the main label.
#define ToggleDesert
Toggle the snow/desert state of a road tile.
static const byte _roadveh_enter_depot_dir[4]
Given the direction the road depot is pointing, this is the direction the vehicle should be travellin...
EconomySettings economy
settings to change the economy
static bool IsCrossingBarred(TileIndex t)
Check if the level crossing is barred.
@ MAX_COMPANIES
Maximum number of companies.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
@ TRACK_BIT_X
X-axis track.
const TileTypeProcs _tile_type_road_procs
Tile callback functions for road tiles.
@ ROAD_NE
North-east part.
static RoadTileType GetRoadTileType(TileIndex t)
Get the type of the road tile.
@ ROAD_SE
South-east part.
static TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
Builds a TrackStatus.
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
Money GetCost() const
The costs as made up to this moment.
static TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
static bool IsBridge(TileIndex t)
Checks if this is a bridge, instead of a tunnel.
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
static bool IsOnSnow(TileIndex t)
Check if a road tile has snow/desert.
@ CMD_REMOVE_SINGLE_RAIL
remove a single rail track
Ground palette sprite of a tile, together with its sprite layout.
RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
Clean up unnecessary RoadBits of a planned tile.
@ 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.
@ ROAD_ALL
Full 4-way crossing.
static bool AutoslopeEnabled()
Tests if autoslope is enabled for _current_company.
void UpdateLevelCrossing(TileIndex tile, bool sound=true)
Sets correct crossing state.
Money GetAvailableMoneyForCommand()
@ TRACKDIR_X_NE
X-axis and direction to north-east.
uint32 road[ROADTYPE_END]
Count of company owned track bits for each road type.
static bool HasCrossingReservation(TileIndex t)
Get the reservation state of the rail crossing.
@ FOUNDATION_NONE
The tile has no foundation, the slope remains unchanged.
static bool IsRoadDepot(TileIndex t)
Return whether a tile is a road depot.
StringID name
Name of this rail type.
@ SLOPE_SW
south and west corner are raised
bool ValParamRoadType(RoadType roadtype)
Validate functions for rail building.
static DiagDirection GetRoadStopDir(TileIndex t)
Gets the direction the road stop entrance points towards.
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height)
Mark bridge tiles dirty.
Slope
Enumeration for the slope-type.
DiagDirection
Enumeration for diagonal directions.
Slope GetFoundationSlope(TileIndex tile, int *z)
Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation,...
GRFLoadedFeatures _loaded_newgrf_features
Indicates which are the newgrf features currently loaded ingame.
@ TRACK_BIT_ALL
All possible tracks.
struct RailtypeInfo::@38 base_sprites
Struct containing the main sprites.
SpriteID build_tunnel
button for building a tunnel
@ ROADTYPE_BEGIN
Used for iterations.
@ ZOOM_LVL_DETAIL
All zoomlevels below or equal to this, will result in details on the screen, like road-work,...
@ ROADSIDE_TREES
Road with trees on paved sidewalks.
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
@ TRACK_BIT_LOWER
Lower track.
bool show_track_reservation
highlight reserved tracks.
CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a long piece of road.
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.
RoadType
The different roadtypes we support.
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
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
@ CMD_CONVERT_ROAD
convert a road type
static bool CanConvertUnownedRoadType(Owner owner, RoadTramType rtt)
Checks the tile and returns whether the current player is allowed to convert the roadtype to another ...
static DiagDirection AxisToDiagDir(Axis a)
Converts an Axis to a DiagDirection.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
@ ROAD_NW
North-west part.
static DiagDirection GetTunnelBridgeDirection(TileIndex t)
Get the direction pointing to the other end.
void ChangeTownRating(Town *t, int add, int max, DoCommandFlag flags)
Changes town rating of the current company.
static Owner GetTileOwner(TileIndex tile)
Returns the owner of a tile.
void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, int h, int dz, int z, bool transparent, int bb_offset_x, int bb_offset_y, int bb_offset_z, const SubSprite *sub)
Draw a (transparent) sprite at given coordinates with a given bounding box.
static void ConvertRoadTypeOwner(TileIndex tile, uint num_pieces, Owner owner, RoadType from_type, RoadType to_type)
Convert the ownership of the RoadType of the tile if applicable.
Direction direction
facing
static uint ApplyPixelFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
static void DrawTile_Road(TileInfo *ti)
Tile callback function for rendering a road tile to the screen.
bool _generating_world
Whether we are generating the map or not.
byte dist_local_authority
distance for town local authority, default 20
uint DistanceSquare(TileIndex t0, TileIndex t1)
Gets the 'Square' distance between the two given tiles.
SpriteID build_x_road
button for building single rail in X direction
SpriteID convert_road
button for converting road types
static void SetRoadType(TileIndex t, RoadTramType rtt, RoadType rt)
Set the road type of a tile.
static Direction ReverseDir(Direction d)
Return the reverse of a direction.
void MakeDefaultName(T *obj)
Set the default name for a depot/waypoint.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
@ TRACKDIR_BIT_NONE
No track build.
static DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
Gets the disallowed directions.
static const uint ROAD_DEPOT_TRACKBIT_FACTOR
Multiplier for how many regular track bits a road depot counts.
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
CompanyID _current_company
Company currently doing an action.
static bool HasRoadCatenary(RoadType roadtype)
Test if a road type has catenary.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
static const PaletteID PALETTE_TO_BARE_LAND
sets colour to bare land stuff for rail, road and crossings
static Slope SlopeWithOneCornerRaised(Corner corner)
Returns the slope with a specific corner raised.
@ TRACK_BIT_LEFT
Left track.
DisallowedRoadDirections
Which directions are disallowed ?
TramReplacement tram
In which way tram depots were replaced.
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
static const Date INVALID_DATE
Representation of an invalid date.
RoadTypeLabel label
Unique 32 bit road type identifier.
@ DRD_BOTH
All directions are disallowed.
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
static void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
Sets the disallowed directions.
static bool IsSlopeWithOneCornerRaised(Slope s)
Tests if a specific slope has exactly one corner raised.
@ TRAMWAY_REPLACE_DEPOT_WITH_TRACK
Electrified depot graphics with tram track were loaded.
TileType
The different types of tiles.
@ ROAD_TILE_DEPOT
Depot (one entrance)
uint32 PaletteID
The number of the palette.
static bool HasRailCatenaryDrawn(RailType rt)
Test if we should draw rail catenary.
bool build_on_slopes
allow building on slopes
@ ROTSG_OVERLAY
Optional: Images for overlaying track.
CursorID autoroad
Cursor for autorail tool.
static void DrawRoadDetail(SpriteID img, const TileInfo *ti, int dx, int dy, int h, bool transparent)
Draws details on/around the road.
static Money RoadClearCost(RoadType roadtype)
Returns the cost of clearing the specified roadtype.
@ TRACKDIR_Y_NW
Y-axis and direction to north-west.
static void SetTownIndex(TileIndex t, TownID index)
Set the town index for a road or house tile.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
@ OWNER_NONE
The tile has no ownership.
@ FOUNDATION_LEVELED
The tile is leveled up to a flat slope.
uint32 rail[RAILTYPE_END]
Count of company owned track bits for each rail type.
static void MakeRoadNormal(TileIndex t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
Make a normal road tile.
static TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
@ WC_VEHICLE_DEPOT
Depot view; Window numbers:
CommandCost CmdConvertRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Convert one road subtype to another.
@ MP_STATION
A tile of a station.
@ ROTSG_CATENARY_FRONT
Optional: Catenary front.
TownCache cache
Container for all cacheable data.
static Axis GetCrossingRailAxis(TileIndex t)
Get the rail axis of a level crossing.
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Find a vehicle from a specific location.
void UpdateCompanyRoadInfrastructure(RoadType rt, Owner o, int count)
Update road infrastructure counts for a company.
@ RAIL_TILE_NORMAL
Normal rail tile without signals.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
@ RATING_ROAD_DOWN_STEP_EDGE
removing a roadpiece at the edge
@ DIAGDIR_BEGIN
Used for iterations.
static const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
StringID str
Description of the tile.
@ DC_AUTO
don't allow building on structures
static int GetTileMaxPixelZ(TileIndex tile)
Get top height of the tile.
struct RailtypeInfo::@41 strings
Strings associated with the rail type.
A special vehicle is one of the following:
EffectVehicle * CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type)
Create an effect vehicle above a particular location.
static Pool::IterateWrapper< RoadVehicle > Iterate(size_t from=0)
Returns an iterable ensemble of all valid vehicles of type T.
void DrawGroundSpriteAt(SpriteID image, PaletteID pal, int32 x, int32 y, int z, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
Draws a ground sprite at a specific world-coordinate relative to the current tile.
#define IsOnDesert
Check if a road tile has snow/desert.
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
TrackBits
Bitfield corresponding to Track.
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
static Foundation GetRoadFoundation(Slope tileh, RoadBits bits)
Get the foundationtype of a RoadBits Slope combination.
static uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
Calculates the length of a tunnel or a bridge (without end tiles)
Date build_date
Date of construction.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
#define lengthof(x)
Return the length of an fixed size array.
@ ROTSG_DEPOT
Optional: Depot images.
uint16 rail_speed
Speed limit of rail (bridges and track)
static TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track bits incidating with that diagdir.
uint16 max_speed
Maximum speed for vehicles travelling on this road type.
@ DRD_SOUTHBOUND
All southbound traffic is disallowed.
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
void DrawRoadTypeCatenary(const TileInfo *ti, RoadType rt, RoadBits rb)
Draws the catenary for the RoadType of the given tile.
void DrawRailCatenary(const TileInfo *ti)
Draws overhead wires and pylons for electric railways.
static Money RoadBuildCost(RoadType roadtype)
Returns the cost of building the specified roadtype.
static bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
Checks if an engine of the given RoadType got power on a tile with a given RoadType.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
static bool IsNormalRoadTile(TileIndex t)
Return whether a tile is a normal road tile.
Axis
Allow incrementing of DiagDirDiff variables.
static void SetRoadside(TileIndex tile, Roadside s)
Set the decorations of a road.
static void MakeRoadDepot(TileIndex t, Owner owner, DepotID did, DiagDirection dir, RoadType rt)
Make a road depot.
static Owner GetRoadOwner(TileIndex t, RoadTramType rtt)
Get the owner of a specific road type.
@ RATING_ROAD_DOWN_STEP_INNER
removing a roadpiece in the middle
StringID owner_type[4]
Type of each owner.
static Axis GetCrossingRoadAxis(TileIndex t)
Get the road axis of a level crossing.
static TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
Determines type of the wormhole and returns its other end.
static const uint ROAD_STOP_TRACKBIT_FACTOR
Multiplier for how many regular track bits a bay stop counts.
RoadType AllocateRoadType(RoadTypeLabel label, RoadTramType rtt)
Allocate a new road type label.
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
static uint GetRoadSpriteOffset(Slope slope, RoadBits bits)
Get the sprite offset within a spritegroup.
@ TRACK_BIT_Y
Y-axis track.
TileIndex tile
Tile index.
static const RoadBits _invalid_tileh_slopes_road[2][15]
Invalid RoadBits on slopes.
ConstructionSettings construction
construction of things in-game
static RoadBits MirrorRoadBits(RoadBits r)
Calculate the mirrored RoadBits.
@ ROTFB_NONE
All flags cleared.
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
SpriteID crossing
level crossing, rail in X direction
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
VehicleType type
Type of vehicle.
@ TRACKDIR_X_SW
X-axis and direction to south-west.
StringID tramtype
Type of tram on the tile.
T * First() const
Get the first vehicle in the chain.
RoadTypes _roadtypes_type
Bitmap of road/tram types.
CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a road depot.
static bool RoadNoLevelCrossing(RoadType roadtype)
Test if road disallows level crossings.
@ TUNNELBRIDGE_REMOVE
Removal of a tunnel or bridge owned by the towb.
static Slope GetTilePixelSlope(TileIndex tile, int *h)
Return the slope of a given tile.
Track
These are used to specify a single track.
uint ApplyFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existing, RoadBits other)
Calculate the costs for roads on slopes Aside modify the RoadBits to fit on the slopes.
@ ROAD_REMOVE
Removal of a road owned by the town.
void ShowDepotWindow(TileIndex tile, VehicleType type)
Opens a depot window.
static TransportType GetTunnelBridgeTransportType(TileIndex t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
static TrackBits GetCrossingRailBits(TileIndex tile)
Get the rail track bits of a level crossing.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
@ ROADTYPES_NONE
No roadtypes.
@ RVSB_IN_DEPOT
The vehicle is in a depot.
@ SLOPE_SE
south and east corner are raised
static bool HasRoadWorks(TileIndex t)
Check if a tile has road works.
@ OWNER_WATER
The tile/execution is done by "water".
#define CLRBITS(x, y)
Clears several bits in a variable.
@ ROTSG_CATENARY_BACK
Optional: Catenary back.
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.
@ SLOPE_NE
north and east corner are raised
static const SpriteID SPR_ONEWAY_BASE
One way road sprites.
VehicleEnterTileStatus
The returned bits of VehicleEnterTile.
@ CMD_LANDSCAPE_CLEAR
demolish a tile
@ OWNER_TOWN
A town owns the tile, or a town is expanding.
CommandCost TunnelBridgeIsFree(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
Finds vehicle in tunnel / bridge.
void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
Draws a ground sprite for the current tile.
GUISettings gui
settings related to the GUI
@ ROADSIDE_GRASS_ROAD_WORKS
Road on grass with road works.
static bool MayHaveRoad(TileIndex t)
Test whether a tile can have road/tram types.
static const SpriteID SPR_TRAMWAY_BASE
Tramway sprites.
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
@ VETSB_ENTERED_WORMHOLE
The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/...
static bool IsBridgeAbove(TileIndex t)
checks if a bridge is set above the ground of this tile
uint16 road_speed
Speed limit of road (bridges and track)