OpenTTD Source 20260311-master-g511d3794ce
water_cmd.cpp File Reference

Handling of water tiles. More...

#include "stdafx.h"
#include "landscape.h"
#include "viewport_func.h"
#include "command_func.h"
#include "town.h"
#include "news_func.h"
#include "depot_base.h"
#include "depot_func.h"
#include "water.h"
#include "industry_map.h"
#include "newgrf_canal.h"
#include "strings_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
#include "company_func.h"
#include "clear_map.h"
#include "tree_map.h"
#include "aircraft.h"
#include "effectvehicle_func.h"
#include "tunnelbridge_map.h"
#include "station_base.h"
#include "ai/ai.hpp"
#include "game/game.hpp"
#include "core/random_func.hpp"
#include "core/backup_type.hpp"
#include "timer/timer_game_calendar.h"
#include "company_base.h"
#include "company_gui.h"
#include "newgrf_generic.h"
#include "industry.h"
#include "water_cmd.h"
#include "landscape_cmd.h"
#include "pathfinder/water_regions.h"
#include "town_type.h"
#include "table/strings.h"
#include "safeguards.h"
#include "table/water_land.h"

Go to the source code of this file.

Functions

static void MarkTileDirtyIfCanalOrRiver (TileIndex tile)
 Marks tile dirty if it is a canal or river tile.
static void MarkCanalsAndRiversAroundDirty (TileIndex tile)
 Marks the tiles around a tile as dirty, if they are canals or rivers.
void ClearNeighbourNonFloodingStates (TileIndex tile)
 Clear non-flooding state of the tiles around a tile.
CommandCost CmdBuildShipDepot (DoCommandFlags flags, TileIndex tile, Axis axis)
 Build a ship depot.
bool IsPossibleDockingTile (Tile t)
 Check whether it is feasible that the given tile could be a docking tile.
void CheckForDockingTile (TileIndex t)
 Mark the supplied tile as a docking tile if it is suitable for docking.
void MakeWaterKeepingClass (TileIndex tile, Owner o)
static CommandCost RemoveShipDepot (TileIndex tile, DoCommandFlags flags)
static uint8_t GetLockPartMinimalBridgeHeight (LockPart lock_part)
 Get the minimal height required for a bridge above a lock part.
static CommandCost DoBuildLock (TileIndex tile, DiagDirection dir, DoCommandFlags flags)
 Builds a lock.
static CommandCost RemoveLock (TileIndex tile, DoCommandFlags flags)
 Remove a lock.
CommandCost CmdBuildLock (DoCommandFlags flags, TileIndex tile)
 Builds a lock.
void MakeRiverAndModifyDesertZoneAround (TileIndex tile)
 Make a river tile and remove desert directly around it.
CommandCost CmdBuildCanal (DoCommandFlags flags, TileIndex tile, TileIndex start_tile, WaterClass wc, bool diagonal)
 Build a piece of canal.
static CommandCost ClearTile_Water (TileIndex tile, DoCommandFlags flags)
 Tile callback function signature for clearing a tile.
bool IsWateredTile (TileIndex tile, Direction from)
 return true if a tile is a water tile wrt.
static void DrawWaterSprite (SpriteID base, uint offset, CanalFeature feature, TileIndex tile)
 Draw a water sprite, potentially with a NewGRF-modified sprite offset.
static void DrawWaterEdges (bool canal, uint offset, TileIndex tile)
 Draw canal or river edges.
static void DrawSeaWater (TileIndex)
 Draw a plain sea water tile with no edges.
static void DrawCanalWater (TileIndex tile)
 Draw a canal styled water tile with dikes around.
static void DrawWaterTileStruct (const TileInfo *ti, std::span< const DrawTileSeqStruct > seq, SpriteID base, uint offset, PaletteID palette, CanalFeature feature)
 Draw a build sprite sequence for water tiles.
static void DrawWaterLock (const TileInfo *ti)
 Draw a lock tile.
static void DrawWaterDepot (const TileInfo *ti)
 Draw a ship depot tile.
static void DrawRiverWater (const TileInfo *ti)
void DrawShoreTile (Slope tileh)
void DrawWaterClassGround (const TileInfo *ti)
static void DrawTile_Water (TileInfo *ti)
 Tile callback function signature for drawing a tile and its contents to the screen.
void DrawShipDepotSprite (int x, int y, Axis axis, DepotPart part)
static int GetSlopePixelZ_Water (TileIndex tile, uint x, uint y, bool ground_vehicle)
 Tile callback function signature for obtaining the world Z coordinate of a given point of a tile.
static void GetTileDesc_Water (TileIndex tile, TileDesc &td)
 Tile callback function signature for obtaining a tile description.
static void FloodVehicle (Vehicle *v)
 Handle the flooding of a vehicle.
static void FloodVehicleProc (Vehicle *v, int z)
 Flood a vehicle if we are allowed to flood it, i.e.
static void FloodVehiclesOnTile (TileIndex tile, int z)
static void FloodVehicles (TileIndex tile)
 Finds a vehicle to flood.
FloodingBehaviour GetFloodingBehaviour (TileIndex tile)
 Returns the behaviour of a tile during flooding.
static void DoFloodTile (TileIndex target)
 Floods a tile.
static void DoDryUp (TileIndex tile)
 Drys a tile up.
void TileLoop_Water (TileIndex tile)
 Tile callback function signature for running periodic tile updates.
void ConvertGroundTilesIntoWaterTiles ()
static TrackStatus GetTileTrackStatus_Water (TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
 Tile callback function signature for getting the possible tracks that can be taken on a given tile by a given transport.
static bool ClickTile_Water (TileIndex tile)
 Tile callback function signature for clicking a tile.
static void ChangeTileOwner_Water (TileIndex tile, Owner old_owner, Owner new_owner)
 Tile callback function signature for changing the owner of a tile.
static CommandCost TerraformTile_Water (TileIndex tile, DoCommandFlags flags, int z_new, Slope tileh_new)
 Tile callback function signature of the terraforming callback.
static CommandCost CheckBuildAbove_Water (TileIndex tile, DoCommandFlags flags, Axis axis, int height)
 Tile callback function signature to test if a bridge can be built above a tile.

Variables

static const Directions _flood_from_dirs []
 Describes from which directions a specific slope can be flooded (if the tile is floodable at all).
const TileTypeProcs _tile_type_water_procs
 TileTypeProcs definitions for TileType::Water tiles.

Detailed Description

Handling of water tiles.

Definition in file water_cmd.cpp.

Function Documentation

◆ ChangeTileOwner_Water()

void ChangeTileOwner_Water ( TileIndex tile,
Owner old_owner,
Owner new_owner )
static

Tile callback function signature for changing the owner of a tile.

Parameters
tileThe tile to process.
old_ownerThe owner to replace.
new_ownerThe owner to replace with.
See also
ChangeTileOwner

Definition at line 1425 of file water_cmd.cpp.

References Bankrupt, Canal, Execute, GetLockPart(), GetWaterClass(), INVALID_OWNER, IsLock(), IsShipDepot(), IsTileOwner(), LOCK_DEPOT_TILE_FACTOR, Middle, OWNER_NONE, and SetTileOwner().

◆ CheckBuildAbove_Water()

CommandCost CheckBuildAbove_Water ( TileIndex tile,
DoCommandFlags flags,
Axis axis,
int height )
static

Tile callback function signature to test if a bridge can be built above a tile.

Parameters
tileThe involved tile.
flagsCommand flags passed to the build command.
axisAxis of bridge being built.
heightAbsolute height of bridge platform.
Returns
Error code or extra cost for building bridge above the tile.
See also
CheckBuildAbove

Definition at line 1474 of file water_cmd.cpp.

References CommandCostWithParam(), GetLockPart(), GetLockPartMinimalBridgeHeight(), GetTileMaxZ(), IsCoast(), IsLock(), IsWater(), and TILE_HEIGHT_STEP.

◆ CheckForDockingTile()

void CheckForDockingTile ( TileIndex t)

◆ ClearNeighbourNonFloodingStates()

void ClearNeighbourNonFloodingStates ( TileIndex tile)

Clear non-flooding state of the tiles around a tile.

Parameters
tileThe centre of the tile where other tiles' non-flooding state is cleared.

Definition at line 98 of file water_cmd.cpp.

References DIR_BEGIN, DIR_END, IsTileType(), IsValidTile(), SetNonFloodingWaterTile(), TileOffsByDir(), and Water.

Referenced by BuildObject(), ClearTile_Water(), CmdBuildBuoy(), CmdLandscapeClear(), PlantTreesOnTile(), and RemoveLock().

◆ ClearTile_Water()

◆ ClickTile_Water()

bool ClickTile_Water ( TileIndex tile)
static

Tile callback function signature for clicking a tile.

Parameters
tileThe tile that was clicked.
Returns
Whether any action was taken.
See also
ClickTile

Definition at line 1415 of file water_cmd.cpp.

References Depot, GetShipDepotNorthTile(), GetWaterTileType(), ShowDepotWindow(), and VEH_SHIP.

◆ CmdBuildCanal()

CommandCost CmdBuildCanal ( DoCommandFlags flags,
TileIndex tile,
TileIndex start_tile,
WaterClass wc,
bool diagonal )

Build a piece of canal.

Parameters
flagstype of operation
tileend tile of stretch-dragging
start_tilestart tile of stretch-dragging
wcwaterclass to build. sea and river can only be built in scenario editor
diagonalWhether to use the Orthogonal (0) or Diagonal (1) iterator.
Returns
the cost of this operation or an error

Definition at line 499 of file water_cmd.cpp.

References _current_company, _price, CommandCost::AddCost(), BuildCanal, Canal, CheckForDockingTile(), CMD_ERROR, TileIterator::Create(), DirtyCompanyInfrastructureWindows(), Execute, EXPENSES_CONSTRUCTION, CommandCost::Failed(), CommandCost::GetCost(), GetTileOwner(), GetTileSlope(), GetTropicZone(), INVALID_TILE, IsCanal(), IsInclinedSlope(), IsTileOwner(), IsTileType(), IsValidWaterClass(), IsWaterTile(), MakeCanal(), MakeRiver(), MakeSea(), MarkCanalsAndRiversAroundDirty(), MarkTileDirtyByTile(), OWNER_NONE, River, RIVER_OFFSET_DESERT_DISTANCE, Sea, SetTropicZone(), Map::Size(), SLOPE_FLAT, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TileHeight(), TROPICZONE_DESERT, TROPICZONE_NORMAL, and Water.

◆ CmdBuildLock()

CommandCost CmdBuildLock ( DoCommandFlags flags,
TileIndex tile )

Builds a lock.

Parameters
flagstype of operation
tiletile where to place the lock
Returns
the cost of this operation or an error

Definition at line 460 of file water_cmd.cpp.

References _settings_game, DoBuildLock(), GetInclinedSlopeDirection(), GetTileSlope(), INVALID_DIAGDIR, IsInsideMM(), Map::MaxX(), Map::MaxY(), ReverseDiagDir(), TileAddByDiagDir(), TileX(), and TileY().

◆ CmdBuildShipDepot()

◆ ConvertGroundTilesIntoWaterTiles()

void ConvertGroundTilesIntoWaterTiles ( )

Definition at line 1351 of file water_cmd.cpp.

◆ DoBuildLock()

◆ DoDryUp()

◆ DoFloodTile()

◆ DrawCanalWater()

void DrawCanalWater ( TileIndex tile)
static

Draw a canal styled water tile with dikes around.

Parameters
tileThe tile to draw as canal.

Definition at line 823 of file water_cmd.cpp.

References _water_feature, CFF_HAS_FLAT_SPRITE, DrawWaterEdges(), DrawWaterSprite(), GetCanalSprite(), and HasBit().

◆ DrawRiverWater()

void DrawRiverWater ( const TileInfo * ti)
static

Definition at line 912 of file water_cmd.cpp.

◆ DrawSeaWater()

void DrawSeaWater ( TileIndex )
static

Draw a plain sea water tile with no edges.

Definition at line 814 of file water_cmd.cpp.

References DrawGroundSprite().

◆ DrawShipDepotSprite()

void DrawShipDepotSprite ( int x,
int y,
Axis axis,
DepotPart part )

Definition at line 1007 of file water_cmd.cpp.

◆ DrawShoreTile()

void DrawShoreTile ( Slope tileh)

Definition at line 950 of file water_cmd.cpp.

◆ DrawTile_Water()

void DrawTile_Water ( TileInfo * ti)
static

Tile callback function signature for drawing a tile and its contents to the screen.

Parameters
tiInformation about the tile to draw

Definition at line 978 of file water_cmd.cpp.

References AXIS_X, Clear, Coast, Depot, DiagDirToAxis(), DrawBridgeMiddle(), DrawWaterDepot(), DrawWaterLock(), GetLockDirection(), GetWaterTileType(), Lock, TileInfo::tile, and TileInfo::tileh.

◆ DrawWaterClassGround()

void DrawWaterClassGround ( const TileInfo * ti)

Definition at line 967 of file water_cmd.cpp.

◆ DrawWaterDepot()

void DrawWaterDepot ( const TileInfo * ti)
static

Draw a ship depot tile.

Parameters
tiThe tile information of the ship depot tile.

Definition at line 906 of file water_cmd.cpp.

References DrawWaterTileStruct(), GetCompanyPalette(), GetShipDepotAxis(), GetShipDepotPart(), GetTileOwner(), TileInfo::tile, and to_underlying().

Referenced by DrawTile_Water().

◆ DrawWaterEdges()

void DrawWaterEdges ( bool canal,
uint offset,
TileIndex tile )
static

Draw canal or river edges.

Parameters
canalTrue if canal edges should be drawn, false for river edges.
offsetSprite offset.
tileTile to draw.

Definition at line 761 of file water_cmd.cpp.

References DIR_E, DIR_N, DIR_NE, DIR_NW, DIR_S, DIR_SE, DIR_SW, DIR_W, DrawWaterSprite(), GetCanalSprite(), IsWateredTile(), and TileAddXY().

Referenced by DrawCanalWater().

◆ DrawWaterLock()

void DrawWaterLock ( const TileInfo * ti)
static

◆ DrawWaterSprite()

void DrawWaterSprite ( SpriteID base,
uint offset,
CanalFeature feature,
TileIndex tile )
static

Draw a water sprite, potentially with a NewGRF-modified sprite offset.

Parameters
baseSprite base.
offsetSprite offset.
featureThe type of sprite that is drawn.
tileTile index to draw.

Definition at line 746 of file water_cmd.cpp.

References DrawGroundSprite(), and GetCanalSpriteOffset().

Referenced by DrawCanalWater(), and DrawWaterEdges().

◆ DrawWaterTileStruct()

void DrawWaterTileStruct ( const TileInfo * ti,
std::span< const DrawTileSeqStruct > seq,
SpriteID base,
uint offset,
PaletteID palette,
CanalFeature feature )
static

Draw a build sprite sequence for water tiles.

If buildings are invisible, nothing will be drawn.

Parameters
tiTile info.
seqSprite sequence to draw.
baseBase sprite.
offsetAdditional sprite offset.
palettePalette to use.
featureThe canal feature to get the sprite offset to apply from.

Definition at line 848 of file water_cmd.cpp.

References AddSortableSpriteToDraw(), GetCanalSpriteOffset(), IsInvisibilitySet(), IsTransparencySet(), TileInfo::tile, and TO_BUILDINGS.

Referenced by DrawWaterDepot(), and DrawWaterLock().

◆ FloodVehicle()

void FloodVehicle ( Vehicle * v)
static

Handle the flooding of a vehicle.

This sets the vehicle state to crashed, creates a newsitem and dirties the necessary windows.

Parameters
vThe vehicle to flood.

Definition at line 1053 of file water_cmd.cpp.

References _settings_client, Accident, Vehicle::Crash(), CreateEffectVehicleRel(), EV_EXPLOSION_LARGE, GetEncodedString(), AI::NewEvent(), Game::NewEvent(), Vehicle::owner, SND_12_EXPLOSION, and Vehicle::tile.

Referenced by FloodVehicleProc().

◆ FloodVehicleProc()

void FloodVehicleProc ( Vehicle * v,
int z )
static

Flood a vehicle if we are allowed to flood it, i.e.

when it is on the ground.

Parameters
vThe vehicle to test for flooding.
zThe z of level to flood.

Definition at line 1069 of file water_cmd.cpp.

References AIR_SHADOW, Station::airport, Crashed, AirportFTAClass::delta_z, Vehicle::First(), FloodVehicle(), BaseStation::GetByTile(), Airport::GetFTA(), GetTileMaxZ(), IsAirportTile(), Vehicle::subtype, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Vehicle::tile, BaseVehicle::type, VEH_AIRCRAFT, VEH_ROAD, VEH_TRAIN, Vehicle::vehstatus, and Vehicle::z_pos.

◆ FloodVehicles()

void FloodVehicles ( TileIndex tile)
static

Finds a vehicle to flood.

It does not find vehicles that are already crashed on bridges, i.e. flooded.

Parameters
tilethe tile where to find a vehicle to flood

Definition at line 1111 of file water_cmd.cpp.

References Station::airport, GetBridgePixelHeight(), BaseStation::GetByTile(), GetOtherBridgeEnd(), IsAirportTile(), and IsBridgeTile().

Referenced by DoFloodTile().

◆ FloodVehiclesOnTile()

void FloodVehiclesOnTile ( TileIndex tile,
int z )
static

Definition at line 1099 of file water_cmd.cpp.

◆ GetFloodingBehaviour()

FloodingBehaviour GetFloodingBehaviour ( TileIndex tile)

Returns the behaviour of a tile during flooding.

Parameters
tileThe tile to get the behaviour for.
Returns
Behaviour of the tile

Definition at line 1140 of file water_cmd.cpp.

References FLOOD_ACTIVE, FLOOD_DRYUP, FLOOD_NONE, GetRailGroundType(), GetTileSlope(), GetTileType(), GetTreeGround(), GetWaterClass(), HalfTileWater, Industry, IsCoast(), IsSlopeWithOneCornerRaised(), Object, Railway, Sea, Shore, Station, Trees, Void, and Water.

Referenced by CheckRailSlope(), and TileLoop_Water().

◆ GetLockPartMinimalBridgeHeight()

uint8_t GetLockPartMinimalBridgeHeight ( LockPart lock_part)
static

Get the minimal height required for a bridge above a lock part.

Parameters
lock_partthe lock part.
Returns
the minimal bridge height.

Definition at line 316 of file water_cmd.cpp.

References End, and to_underlying().

Referenced by CheckBuildAbove_Water(), and DoBuildLock().

◆ GetSlopePixelZ_Water()

int GetSlopePixelZ_Water ( TileIndex tile,
uint x,
uint y,
bool ground_vehicle )
static

Tile callback function signature for obtaining the world Z coordinate of a given point of a tile.

Parameters
tileThe queries tile for the Z coordinate.
xWorld X coordinate in tile "units".
yWorld Y coordinate in tile "units".
ground_vehicleWhether to get the Z coordinate of the ground vehicle, or the ground.
Returns
World Z coordinate at tile ground (vehicle) level, including slopes and foundations.
See also
GetSlopePixelZ

Definition at line 1017 of file water_cmd.cpp.

References GetPartialPixelZ(), and GetTilePixelSlope().

◆ GetTileDesc_Water()

void GetTileDesc_Water ( TileIndex tile,
TileDesc & td )
static

Tile callback function signature for obtaining a tile description.

Parameters
tileTile being queried
tdStorage pointer for returned tile description
See also
GetTileDesc

Definition at line 1025 of file water_cmd.cpp.

References TileDesc::build_date, Canal, Clear, Coast, Depot, GetTileOwner(), GetWaterClass(), GetWaterTileType(), Lock, TileDesc::owner, River, Sea, and TileDesc::str.

◆ GetTileTrackStatus_Water()

TrackStatus GetTileTrackStatus_Water ( TileIndex tile,
TransportType mode,
uint sub_mode,
DiagDirection side )
static

Tile callback function signature for getting the possible tracks that can be taken on a given tile by a given transport.

The return value contains the existing trackdirs and signal states.

see track_func.h for usage of TrackStatus.

Parameters
tilethe tile to get the track status from
modethe mode of transportation
sub_modeused to differentiate between different kinds within the mode
sideThe side where the tile is entered.
Returns
the track status information
See also
GetTileTrackStatus

Definition at line 1387 of file water_cmd.cpp.

References AxisToTrackBits(), Clear, Coast, CombineTrackStatus(), Depot, DiagDirToDiagTrackBits(), GetLockDirection(), GetShipDepotAxis(), GetTileSlope(), GetWaterTileType(), IsTileFlat(), Lock, TileX(), TileY(), TRACK_BIT_ALL, TRACK_BIT_LEFT, TRACK_BIT_LOWER, TRACK_BIT_NONE, TRACK_BIT_RIGHT, TRACK_BIT_UPPER, TRACK_BIT_X, TRACK_BIT_Y, TrackBitsToTrackdirBits(), TRACKDIR_BIT_NONE, and TRANSPORT_WATER.

◆ IsPossibleDockingTile()

bool IsPossibleDockingTile ( Tile t)

Check whether it is feasible that the given tile could be a docking tile.

Parameters
tThe tile to query.
Returns
true iff there is a chance the tile could be a docking tile.
See also
CheckForDockingTile

Definition at line 179 of file water_cmd.cpp.

References GetLockPart(), GetTileTrackStatus(), GetTileType(), IsLock(), IsValidTile(), Middle, Railway, Station, TRACK_BIT_NONE, TrackStatusToTrackBits(), TRANSPORT_WATER, TunnelBridge, and Water.

Referenced by ClearDockingTilesCheckingNeighbours(), CmdBuildSingleRail(), and DoFloodTile().

◆ IsWateredTile()

bool IsWateredTile ( TileIndex tile,
Direction from )

◆ MakeRiverAndModifyDesertZoneAround()

void MakeRiverAndModifyDesertZoneAround ( TileIndex tile)

Make a river tile and remove desert directly around it.

Parameters
tileThe tile to change into river and create non-desert around

Definition at line 479 of file water_cmd.cpp.

References GetTropicZone(), MakeRiver(), MarkTileDirtyByTile(), RIVER_OFFSET_DESERT_DISTANCE, SetTropicZone(), TROPICZONE_DESERT, and TROPICZONE_NORMAL.

Referenced by MakeLake(), MakeWetlands(), and RiverMakeWider().

◆ MakeWaterKeepingClass()

void MakeWaterKeepingClass ( TileIndex tile,
Owner o )

Definition at line 225 of file water_cmd.cpp.

◆ MarkTileDirtyIfCanalOrRiver()

void MarkTileDirtyIfCanalOrRiver ( TileIndex tile)
inlinestatic

Marks tile dirty if it is a canal or river tile.

Called to avoid glitches when flooding tiles next to canal tile.

Parameters
tiletile to check

Definition at line 76 of file water_cmd.cpp.

References IsCanal(), IsRiver(), IsTileType(), IsValidTile(), MarkTileDirtyByTile(), and Water.

Referenced by MarkCanalsAndRiversAroundDirty().

◆ RemoveLock()

◆ RemoveShipDepot()

CommandCost RemoveShipDepot ( TileIndex tile,
DoCommandFlags flags )
static

Definition at line 276 of file water_cmd.cpp.

◆ TerraformTile_Water()

CommandCost TerraformTile_Water ( TileIndex tile,
DoCommandFlags flags,
int z_new,
Slope tileh_new )
static

Tile callback function signature of the terraforming callback.

The function is called when a tile is affected by a terraforming operation. It has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype. With DoCommandFlag::Execute in flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself).

Note
The terraforming has not yet taken place. So GetTileZ() and GetTileSlope() refer to the landscape before the terraforming operation.
Parameters
tileThe involved tile.
flagsCommand flags passed to the terraform command (DoCommandFlag::Execute, DoCommandFlag::QueryCost, etc.).
z_newTileZ after terraforming.
tileh_newSlope after terraforming.
Returns
Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.)
See also
TerraformTile

Definition at line 1462 of file water_cmd.cpp.

References IsCanal(), IsRiver(), and IsWaterTile().

◆ TileLoop_Water()

void TileLoop_Water ( TileIndex tile)

Tile callback function signature for running periodic tile updates.

Parameters
tileThe tile to update.
See also
RunTileLoop

Let a water tile floods its diagonal adjoining tiles called from tunnelbridge_cmd, and by TileLoop_Industry() and TileLoop_Track()

Definition at line 1296 of file water_cmd.cpp.

References _flood_from_dirs, AddTileIndexDiffCWrap(), AmbientSoundEffect(), DIR_BEGIN, DIR_END, DoDryUp(), DoFloodTile(), FLOOD_ACTIVE, FLOOD_DRYUP, FLOOD_PASSIVE, GetFloodingBehaviour(), GetFoundationSlope(), GetTreeGround(), INVALID_TILE, IsBuoy(), IsDock(), IsNonFloodingWaterTile(), IsTileType(), IsValidTile(), ReverseDir(), SetNonFloodingWaterTile(), Shore, SLOPE_HALFTILE_MASK, SLOPE_STEEP, Station, TileIndexDiffCByDir(), Trees, and Water.

Referenced by TileLoop_Industry(), TileLoop_Object(), TileLoop_Rail(), TileLoop_Station(), TileLoop_Trees(), and TileLoop_Void().

Variable Documentation

◆ _flood_from_dirs

const Directions _flood_from_dirs[]
static
Initial value:
= {
{DIR_NE},
{},
{DIR_NW},
{DIR_SE},
{},
{DIR_SW},
}
@ DIR_SW
Southwest.
@ DIR_NW
Northwest.
@ DIR_N
North.
@ DIR_SE
Southeast.
@ DIR_S
South.
@ DIR_NE
Northeast.
@ DIR_W
West.
@ DIR_E
East.

Describes from which directions a specific slope can be flooded (if the tile is floodable at all).

Definition at line 52 of file water_cmd.cpp.

Referenced by TileLoop_Water().

◆ _tile_type_water_procs

const TileTypeProcs _tile_type_water_procs
extern
Initial value:
= {
.draw_tile_proc = DrawTile_Water,
.get_slope_pixel_z_proc = GetSlopePixelZ_Water,
.clear_tile_proc = ClearTile_Water,
.get_tile_desc_proc = GetTileDesc_Water,
.get_tile_track_status_proc = GetTileTrackStatus_Water,
.click_tile_proc = ClickTile_Water,
.tile_loop_proc = TileLoop_Water,
.change_tile_owner_proc = ChangeTileOwner_Water,
.vehicle_enter_tile_proc = [](Vehicle *, TileIndex, int, int) -> VehicleEnterTileStates { return {}; },
.terraform_tile_proc = TerraformTile_Water,
.check_build_above_proc = CheckBuildAbove_Water,
}
Vehicle data structure.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
Definition tile_type.h:92
void TileLoop_Water(TileIndex tile)
Tile callback function signature for running periodic tile updates.
static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlags flags, int z_new, Slope tileh_new)
Tile callback function signature of the terraforming callback.
static void GetTileDesc_Water(TileIndex tile, TileDesc &td)
Tile callback function signature for obtaining a tile description.
static int GetSlopePixelZ_Water(TileIndex tile, uint x, uint y, bool ground_vehicle)
Tile callback function signature for obtaining the world Z coordinate of a given point of a tile.
static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlags flags)
Tile callback function signature for clearing a tile.
static CommandCost CheckBuildAbove_Water(TileIndex tile, DoCommandFlags flags, Axis axis, int height)
Tile callback function signature to test if a bridge can be built above a tile.
static bool ClickTile_Water(TileIndex tile)
Tile callback function signature for clicking a tile.
static void DrawTile_Water(TileInfo *ti)
Tile callback function signature for drawing a tile and its contents to the screen.
static TrackStatus GetTileTrackStatus_Water(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Tile callback function signature for getting the possible tracks that can be taken on a given tile by...
static void ChangeTileOwner_Water(TileIndex tile, Owner old_owner, Owner new_owner)
Tile callback function signature for changing the owner of a tile.

TileTypeProcs definitions for TileType::Water tiles.

Definition at line 58 of file landscape.cpp.