Go to the documentation of this file.
42 #include "table/strings.h"
103 Axis axis = Extract<Axis, 0, 1>(p1);
126 if (ret.
Failed())
return ret;
132 if (ret.
Failed())
return ret;
263 if (ret.
Failed())
return ret;
271 if (ret.
Failed())
return ret;
275 delete Depot::GetByTile(tile);
305 if (ret.
Failed())
return ret;
310 if (ret.
Failed())
return ret;
316 if (ret.
Failed())
return ret;
318 cost.
AddCost(_price[PR_BUILD_CANAL]);
328 if (ret.
Failed())
return ret;
330 cost.
AddCost(_price[PR_BUILD_CANAL]);
362 cost.
AddCost(_price[PR_BUILD_LOCK]);
377 if (ret.
Failed())
return ret;
386 if (ret.
Failed())
return ret;
401 MakeWaterKeepingClass(tile + delta,
GetTileOwner(tile + delta));
402 MakeWaterKeepingClass(tile - delta,
GetTileOwner(tile - delta));
446 WaterClass wc = Extract<WaterClass, 0, 2>(p2);
455 if (_game_mode != GM_EDITOR && ta.
w != 1 && ta.
h != 1)
return CMD_ERROR;
471 if (ret.
Failed())
return ret;
479 if (_game_mode == GM_EDITOR) {
505 cost.
AddCost(_price[PR_BUILD_CANAL]);
521 Money base_cost =
IsCanal(tile) ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER];
530 if (ret.
Failed())
return ret;
535 if (ret.
Failed())
return ret;
546 if (remove) RemoveDockingTile(tile);
557 if (ret.
Failed())
return ret;
563 if (remove) RemoveDockingTile(tile);
575 { { 0, 0}, {0, 0}, { 0, 0}, {0, 0} },
576 { {-1, 0}, {0, 1}, { 1, 0}, {0, -1} },
577 { { 1, 0}, {0, -1}, {-1, 0}, {0, 1} },
588 return RemoveShipDepot(tile, flags);
608 default: NOT_REACHED();
618 default:
return false;
630 default:
return false;
663 default:
return false;
676 if (base != SPR_FLAT_WATER_TILE) {
696 if (base == 0) base = SPR_CANAL_DIKES_BASE;
698 feature = CF_RIVER_EDGE;
700 if (base == 0)
return;
750 SpriteID image = SPR_FLAT_WATER_TILE;
754 if (image == 0) image = SPR_FLAT_WATER_TILE;
778 uint tile_offs = offset + dtss->image.
sprite;
781 ti->
x + dtss->
delta_x, ti->
y + dtss->delta_y,
782 dtss->size_x, dtss->size_y,
783 dtss->size_z, ti->
z + dtss->
delta_z,
798 if (water_base == 0) {
800 water_base = SPR_CANALS_BASE;
803 if (image == SPR_FLAT_WATER_TILE) {
810 if (image < 5) image += water_base;
819 base = SPR_LOCK_BASE;
821 zoffs = ti->
z > z_threshold ? 24 : 0;
830 DrawWaterClassGround(ti);
834 static void DrawRiverWater(
const TileInfo *ti)
836 SpriteID image = SPR_FLAT_WATER_TILE;
838 uint edges_offset = 0;
844 case SLOPE_NW: image = SPR_WATER_SLOPE_Y_DOWN;
break;
845 case SLOPE_SW: image = SPR_WATER_SLOPE_X_UP;
break;
846 case SLOPE_SE: image = SPR_WATER_SLOPE_Y_UP;
break;
847 case SLOPE_NE: image = SPR_WATER_SLOPE_X_DOWN;
break;
848 default: image = SPR_FLAT_WATER_TILE;
break;
855 case SLOPE_SE: edges_offset += 12;
break;
856 case SLOPE_NE: offset += 1; edges_offset += 24;
break;
857 case SLOPE_SW: offset += 2; edges_offset += 36;
break;
858 case SLOPE_NW: offset += 3; edges_offset += 48;
break;
859 default: offset = 0;
break;
872 void DrawShoreTile(
Slope tileh)
876 static const byte tileh_to_shoresprite[32] = {
877 0, 1, 2, 3, 4, 16, 6, 7, 8, 9, 17, 11, 12, 13, 14, 0,
878 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 10, 15, 0,
889 void DrawWaterClassGround(
const TileInfo *ti)
895 default: NOT_REACHED();
899 static void DrawTile_Water(
TileInfo *ti)
903 DrawWaterClassGround(ti);
908 DrawShoreTile(ti->
tileh);
923 void DrawShipDepotSprite(
int x,
int y,
Axis axis,
DepotPart part)
932 static int GetSlopePixelZ_Water(
TileIndex tile, uint x, uint y)
953 default: NOT_REACHED();
959 td->
str = STR_LAI_WATER_DESCRIPTION_SHIP_DEPOT;
962 default: NOT_REACHED();
975 uint pass = v->
Crash(
true);
980 AddTileNewsItem(STR_NEWS_DISASTER_FLOOD_VEHICLE,
NT_ACCIDENT, v->
tile);
1014 int z = *(
int*)data;
1015 if (v->
z_pos > z)
break;
1100 bool flooded =
false;
1178 default: NOT_REACHED();
1180 SetRailGroundType(tile, new_ground);
1198 default: NOT_REACHED();
1227 if (z_dest > 0)
continue;
1253 void ConvertGroundTilesIntoWaterTiles()
1307 if (
TileX(tile) == 0) {
1311 if (
TileY(tile) == 0) {
1318 static bool ClickTile_Water(
TileIndex tile)
1379 GetSlopePixelZ_Water,
1383 GetTileTrackStatus_Water,
1387 ChangeTileOwner_Water,
1390 GetFoundation_Water,
1391 TerraformTile_Water,
@ VEH_AIRCRAFT
Aircraft vehicle type.
@ MP_CLEAR
A tile without any structures, i.e. grass, rocks, farm fields etc.
bool IsTileFlat(TileIndex tile, int *h)
Check if a given tile is flat.
@ FLOOD_DRYUP
The tile drys up if it is not constantly flooded from neighboured tiles.
@ LOCK_PART_UPPER
Upper part of a lock.
uint32 TileIndex
The index/ID of a Tile.
@ TROPICZONE_DESERT
Tile is desert.
TileArea docking_station
Tile area the docking tiles cover.
@ TRACK_BIT_NONE
No track.
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.
TileIndex GetOtherBridgeEnd(TileIndex tile)
Starting at one bridge end finds the other bridge end.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
Direction
Defines the 8 directions on the map.
static bool IsCanal(TileIndex t)
Is it a canal tile?
static TileIndex GetOtherShipDepotTile(TileIndex t)
Get the other tile of the ship depot.
@ DIR_BEGIN
Used to iterate.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
static const SpriteID SPR_SHORE_BASE
shore tiles - action 05-0D
static void DrawOrigTileSeqInGUI(int x, int y, const DrawTileSprites *dts, PaletteID default_palette)
Draw TTD sprite sequence in GUI.
static SigSegState UpdateSignalsInBuffer(Owner owner)
Updates blocks in _globset buffer.
uint x
X position of the tile in unit coordinates.
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.
@ TO_BUILDINGS
company buildings - depots, stations, HQ, ...
Tile information, used while rendering the tile.
Class to backup a specific variable and restore it later.
CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a ship depot.
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...
static DiagDirection GetLockDirection(TileIndex t)
Get the direction of the water lock.
static void DrawWaterLock(const TileInfo *ti)
Draw a lock tile.
Owner owner[4]
Name of the owner(s)
static void AmbientSoundEffect(TileIndex tile)
Play an ambient sound effect for an empty tile.
static void FloodVehicles(TileIndex tile)
Finds a vehicle to flood.
static bool IsAirportTile(TileIndex t)
Is this tile a station tile and an airport tile?
bool IsWateredTile(TileIndex tile, Direction from)
return true if a tile is a water tile wrt.
@ SLOPE_HALFTILE_MASK
three bits used for halftile slopes
static Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
static void MakeSea(TileIndex t)
Make a sea tile.
static TileIndex TileAddByDir(TileIndex tile, Direction dir)
Adds a Direction to a tile.
@ DIAGDIR_END
Used for iterations.
static void MakeClear(TileIndex t, ClearGround g, uint density)
Make a clear tile.
uint32 water
Count of company owned track bits for canals.
Tindex index
Index of this pool item.
virtual uint Crash(bool flooded=false)
Crash the (whole) vehicle chain.
static TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
bool FloodHalftile(TileIndex t)
Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore.
SpriteID sprite
The 'real' sprite.
static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag flags)
Builds a lock.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static bool IsHalftileSlope(Slope s)
Checks for non-continuous slope on halftile foundations.
@ SND_12_EXPLOSION
16 == 0x10 Destruction, crashes, disasters, ...
@ RAIL_GROUND_FENCE_VERT1
Grass with a fence at the eastern side.
uint GetCanalSpriteOffset(CanalFeature feature, TileIndex tile, uint cur_offset)
Get the new sprite offset for a water tile.
@ VETSB_CONTINUE
Bit sets of the above specified bits.
WaterClass
classes of water (for WATER_TILE_CLEAR water tile type).
static void DrawWaterTileStruct(const TileInfo *ti, const DrawTileSeqStruct *dtss, SpriteID base, uint offset, PaletteID palette, CanalFeature feature)
Draw a build sprite sequence for water tiles.
uint GetPartialPixelZ(int x, int y, Slope corners)
Determines height at given coordinate of a slope.
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.
uint y
Y position of the tile in unit coordinates.
ClientSettings _settings_client
The current settings for this game.
@ RAIL_GROUND_FENCE_VERT2
Grass with a fence at the western side.
static bool IsCoast(TileIndex t)
Is it a coast tile?
@ DC_NO_WATER
don't allow building on water
@ CFF_HAS_FLAT_SPRITE
Additional flat ground sprite in the beginning.
@ MP_INDUSTRY
Part of an industry.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
void Add(TileIndex to_add)
Add a single tile to a tile area; enlarge if needed.
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
@ SLOPE_EW
east and west corner are raised
@ WATER_CLASS_RIVER
River.
TransportType
Available types of transport.
@ VEH_ROAD
Road vehicle type.
@ WATER_TILE_DEPOT
Water Depot.
Owner owner
Which company owns the vehicle?
Owner
Enum for all companies/owners.
@ EV_EXPLOSION_LARGE
Various explosions.
@ DC_EXEC
execute the given command
Tile description for the 'land area information' tool.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
DoCommandFlag
List of flags for a command.
Foundation
Enumeration for Foundations.
CommandCost EnsureNoVehicleOnGround(TileIndex tile)
Ensure there is no vehicle at the ground at the given position.
@ AIR_SHADOW
shadow of the aircraft
Station * neutral_station
Associated neutral station.
@ TRACK_BIT_UPPER
Upper track.
bool Succeeded() const
Did this command succeed?
static uint TileX(TileIndex tile)
Get the X component of a tile.
static byte GetLockPart(TileIndex t)
Get the part of a lock.
@ DEPOT_PART_NORTH
Northern part of a depot.
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Returns information about trackdirs and signal states.
@ TRACK_BIT_RIGHT
Right track.
const AirportFTAClass * GetFTA() const
Get the finite-state machine for this airport or the finite-state machine for the dummy airport in ca...
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
Slope tileh
Slope of the tile.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
static bool IsTileOnWater(TileIndex t)
Tests if the tile was built on water.
static TileIndex GetShipDepotNorthTile(TileIndex t)
Get the most northern tile of a ship depot.
Date build_date
Date of construction of tile contents.
PalSpriteID ground
Palette and sprite for the ground.
static TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
Return the offset between to tiles from a TileIndexDiffC struct.
@ WATER_CLASS_INVALID
Used for industry tiles on land (also for oilrig if newgrf says so).
int8 delta_x
0x80 is sequence terminator
static DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
static uint MapSize()
Get the size of the map.
@ EXPENSES_CONSTRUCTION
Construction costs.
static void NewEvent(CompanyID company, ScriptEvent *event)
Queue a new event for an AI.
static bool IsBridgeTile(TileIndex t)
checks if there is a bridge on this tile
Common return value for all commands.
static bool HasTileWaterGround(TileIndex t)
Checks whether the tile has water at the ground.
Date _date
Current date in days (day counter)
static void SetTropicZone(TileIndex tile, TropicZone type)
Set the tropic zone.
#define TILE_AREA_LOOP(var, ta)
A loop which iterates over the tiles of a TileArea.
static uint TileHeight(TileIndex tile)
Returns the height of a tile.
SoundSettings sound
sound effect settings
bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, void *user_data)
Function performing a search around a center tile and going outward, thus in circle.
static Vehicle * FloodVehicleProc(Vehicle *v, void *data)
Flood a vehicle if we are allowed to flood it, i.e.
int8 delta_z
0x80 identifies child sprites
static Industry * GetByTile(TileIndex tile)
Get the industry of the given tile.
@ WATER_TILE_CLEAR
Plain water.
static void MakeLock(TileIndex t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper, WaterClass wc_middle)
Make a water lock.
void DirtyCompanyInfrastructureWindows(CompanyID company)
Redraw all windows with company infrastructure counts.
static TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
Converts TrackBits to TrackdirBits while allowing both directions.
int32 TileIndexDiff
An offset value between to tiles.
TileIndex tile
Current tile index.
static TrackBits TrackStatusToTrackBits(TrackStatus ts)
Returns the present-track-information of a TrackStatus.
static void DrawCanalWater(TileIndex tile)
draw a canal styled water tile with dikes around
@ MP_OBJECT
Contains objects such as transmitters and owned land.
@ VS_CRASHED
Vehicle is crashed.
static bool IsBuoy(TileIndex t)
Is tile t a buoy tile?
@ INVALID_OWNER
An invalid owner.
uint16 w
The width of the area.
bool Failed() const
Did this command fail?
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...
bool RiverModifyDesertZone(TileIndex tile, void *)
Callback to create non-desert around a river tile.
Airport airport
Tile area the airport covers.
Represents the covered area of e.g.
static bool IsShipDepot(TileIndex t)
Is it a water tile with a ship depot on it?
@ LOCK_PART_MIDDLE
Middle part of a lock.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
static TropicZone GetTropicZone(TileIndex tile)
Get the tropic zone.
WaterFeature _water_feature[CF_END]
Table of canal 'feature' sprite groups.
static void NewEvent(class ScriptEvent *event)
Queue a new event for a Game Script.
bool IsTerminator() const
Check whether this is a sequence terminator.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
@ TRACK_BIT_X
X-axis track.
static TileIndexDiff TileOffsByDir(Direction dir)
Convert a Direction to a TileIndexDiff.
static TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
Builds a TrackStatus.
static void SetDockingTile(TileIndex t, bool b)
Set the docking tile state of a tile.
@ SLOPE_STEEP
indicates the slope is steep
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
bool freeform_edges
allow terraforming the tiles at the map edges
SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile)
Lookup the base sprite to use for a canal.
Money GetCost() const
The costs as made up to this moment.
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 IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
Ground palette sprite of a tile, together with its sprite layout.
@ 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.
Finite sTate mAchine (FTA) of an airport.
bool disaster
Play disaster and accident sounds.
@ FOUNDATION_NONE
The tile has no foundation, the slope remains unchanged.
@ SLOPE_SW
south and west corner are raised
Slope
Enumeration for the slope-type.
DiagDirection
Enumeration for diagonal directions.
static void MarkCanalsAndRiversAroundDirty(TileIndex tile)
Marks the tiles around a tile as dirty, if they are canals or rivers.
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,...
@ TRACK_BIT_ALL
All possible tracks.
EffectVehicle * CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicleType type)
Create an effect vehicle above a particular vehicle.
CommandCost CmdBuildLock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Builds a lock.
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
@ TRACK_BIT_LOWER
Lower track.
@ WATER_CLASS_CANAL
Canal.
static DepotPart GetShipDepotPart(TileIndex t)
Get the part of a ship depot.
Set of callback functions for performing tile operations of a given tile type.
@ DC_BANKRUPT
company bankrupts, skip money check, skip vehicle on tile check in some cases
bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d)
Check if a dock tile can be docked from the given direction.
void TileLoop_Water(TileIndex tile)
Let a water tile floods its diagonal adjoining tiles called from tunnelbridge_cmd,...
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
RailGroundType
The ground 'under' the rail.
static DiagDirection GetTunnelBridgeDirection(TileIndex t)
Get the direction pointing to the other end.
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.
@ TREE_GROUND_GRASS
normal grass
@ RAIL_GROUND_WATER
Grass with a fence and shore or water on the free halftile.
uint16 h
The height of the area.
@ MP_TREES
Tile got trees.
A pair-construct of a TileIndexDiff.
void CheckForDockingTile(TileIndex t)
Mark the supplied tile as a docking tile if it is suitable for docking.
byte delta_z
Z adjustment for helicopter pads.
@ DEPOT_PART_SOUTH
Southern part of a depot.
static Direction ReverseDir(Direction d)
Return the reverse of a direction.
void MakeDefaultName(T *obj)
Set the default name for a depot/waypoint.
static bool IsDockTile(TileIndex t)
Is tile t a dock tile?
@ TRACKDIR_BIT_NONE
No track build.
CompanyID _current_company
Company currently doing an action.
@ SLOPE_N
the north corner of the tile is raised
static void FloodVehicle(Vehicle *v)
Handle the flooding of a vehicle.
@ FLOOD_PASSIVE
The tile does not actively flood neighboured tiles, but it prevents them from drying up.
Vehicle * First() const
Get the first vehicle of this vehicle chain.
static WaterClass GetWaterClass(TileIndex t)
Get the water class at a tile.
@ RAIL_GROUND_FENCE_HORIZ1
Grass with a fence at the southern side.
@ DC_FORCE_CLEAR_TILE
do not only remove the object on the tile, but also clear any water left on it
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
void DoFloodTile(TileIndex target)
Floods a tile.
@ TRACK_BIT_LEFT
Left track.
static void DrawSeaWater(TileIndex tile)
Draw a plain sea water tile with no edges.
@ MP_VOID
Invisible tiles at the SW and SE border.
static bool IsPlainRail(TileIndex t)
Returns whether this is plain rails, with or without signals.
void Restore()
Restore the variable.
static WaterTileType GetWaterTileType(TileIndex t)
Get the water tile type at a tile.
static bool IsSlopeWithOneCornerRaised(Slope s)
Tests if a specific slope has exactly one corner raised.
static void MakeShipDepot(TileIndex t, Owner o, DepotID did, DepotPart part, Axis a, WaterClass original_water_class)
Make a ship depot section.
@ DIR_END
Used to iterate.
static bool IsWaterTile(TileIndex t)
Is it a water tile with plain water?
uint32 PaletteID
The number of the palette.
static IndustryID GetIndustryIndex(TileIndex t)
Get the industry ID of the given tile.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
@ TRANSPORT_WATER
Transport over water.
@ OWNER_NONE
The tile has no ownership.
static void MakeShore(TileIndex t)
Helper function to make a coast tile.
static TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
@ MP_STATION
A tile of a station.
FloodingBehaviour
Describes the behaviour of a tile during flooding.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
static const uint RIVER_OFFSET_DESERT_DISTANCE
Circular tile search radius to create non-desert around a river tile.
void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Find a vehicle from a specific location.
@ FLOOD_NONE
The tile does not flood neighboured tiles.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
@ NT_ACCIDENT
An accident or disaster has occurred.
static bool IsLock(TileIndex t)
Is there a lock on a given water tile?
@ DIAGDIR_BEGIN
Used for iterations.
static Axis GetShipDepotAxis(TileIndex t)
Get the axis of the ship depot.
StringID str
Description of the tile.
@ DC_AUTO
don't allow building on structures
@ SLOPE_S
the south corner of the tile is raised
static bool IsRiver(TileIndex t)
Is it a river water tile?
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
static TreeGround GetTreeGround(TileIndex t)
Returns the groundtype for tree tiles.
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
static const uint8 _flood_from_dirs[]
Describes from which directions a specific slope can be flooded (if the tile is floodable at all).
static const uint LOCK_DEPOT_TILE_FACTOR
Multiplier for how many regular tiles a lock counts.
static void DrawWaterDepot(const TileInfo *ti)
Draw a ship depot tile.
@ SLOPE_W
the west corner of the tile is raised
TrackBits
Bitfield corresponding to Track.
byte subtype
subtype (Filled with values from AircraftSubType/DisasterSubType/EffectVehicleType/GroundVehicleSubty...
static bool IsDockingTile(TileIndex t)
Checks whether the tile is marked as a dockling tile.
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
const DrawTileSeqStruct * seq
Array of child sprites. Terminated with a terminator entry.
Date build_date
Date of construction.
@ FLOOD_ACTIVE
The tile floods neighboured tiles.
static void MakeCanal(TileIndex t, Owner o, uint8 random_bits)
Make a canal tile.
static TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track bits incidating with that diagdir.
static int GetBridgePixelHeight(TileIndex tile)
Get the height ('z') of a bridge in pixels.
static bool IsDock(TileIndex t)
Is tile t a dock tile?
static bool IsOilRig(TileIndex t)
Is tile t part of an oilrig?
Axis
Allow incrementing of DiagDirDiff variables.
static CommandCost RemoveLock(TileIndex tile, DoCommandFlag flags)
Remove a lock.
FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
Returns the behaviour of a tile during flooding.
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
@ RAIL_GROUND_FENCE_HORIZ2
Grass with a fence at the northern side.
PaletteID pal
The palette (use PAL_NONE) if not needed)
@ TRACK_BIT_Y
Y-axis track.
TileIndex tile
Tile index.
ConstructionSettings construction
construction of things in-game
static bool IsInclinedSlope(Slope s)
Tests if a specific slope is an inclined slope.
@ SLOPE_NS
north and south corner are raised
CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a piece of canal.
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
@ VEH_TRAIN
Train vehicle type.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
VehicleType type
Type of vehicle.
@ TROPICZONE_NORMAL
Normal tropiczone.
@ WATER_TILE_LOCK
Water lock.
static Slope GetTilePixelSlope(TileIndex tile, int *h)
Return the slope of a given tile.
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...
@ VEH_SHIP
Ship vehicle type.
@ SLOPE_SE
south and east corner are raised
DepotPart
Sections of the water depot.
@ OWNER_WATER
The tile/execution is done by "water".
static void DrawWaterSprite(SpriteID base, uint offset, CanalFeature feature, TileIndex tile)
Draw a water sprite, potentially with a NewGRF-modified sprite offset.
@ SLOPE_NE
north and east corner are raised
#define FOR_EACH_SET_BIT(bitpos_var, bitset_value)
Do an operation for each set set bit in a value.
@ SLOPE_E
the east corner of the tile is raised
VehicleEnterTileStatus
The returned bits of VehicleEnterTile.
@ CMD_LANDSCAPE_CLEAR
demolish a tile
static void DrawWaterEdges(bool canal, uint offset, TileIndex tile)
Draw canal or river edges.
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.
static void MakeRiver(TileIndex t, uint8 random_bits)
Make a river tile.
static void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d)
Set the density and ground type of a tile with trees.
static DiagDirection GetInclinedSlopeDirection(Slope s)
Returns the direction of an inclined slope.
static void MarkTileDirtyIfCanalOrRiver(TileIndex tile)
Marks tile dirty if it is a canal or river tile.
static bool IsBridgeAbove(TileIndex t)
checks if a bridge is set above the ground of this tile
A tile child sprite and palette to draw for stations etc, with 3D bounding box.
static void DoDryUp(TileIndex tile)
Drys a tile up.
CanalFeature
List of different canal 'features'.