OpenTTD Source  20240919-master-gdf0233f4c2
water.h File Reference
#include "water_map.h"
#include "economy_func.h"

Go to the source code of this file.

Enumerations

enum  FloodingBehaviour { FLOOD_NONE, FLOOD_ACTIVE, FLOOD_PASSIVE, FLOOD_DRYUP }
 Describes the behaviour of a tile during flooding. More...
 

Functions

FloodingBehaviour GetFloodingBehaviour (TileIndex tile)
 Returns the behaviour of a tile during flooding. More...
 
void TileLoop_Water (TileIndex tile)
 Let a water tile floods its diagonal adjoining tiles called from tunnelbridge_cmd, and by TileLoop_Industry() and TileLoop_Track() More...
 
bool FloodHalftile (TileIndex t)
 Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore. More...
 
void DoFloodTile (TileIndex target)
 Floods a tile.
 
void ConvertGroundTilesIntoWaterTiles ()
 
void DrawShipDepotSprite (int x, int y, Axis axis, DepotPart part)
 
void DrawWaterClassGround (const struct TileInfo *ti)
 
void DrawShoreTile (Slope tileh)
 
void MakeWaterKeepingClass (TileIndex tile, Owner o)
 
void CheckForDockingTile (TileIndex t)
 Mark the supplied tile as a docking tile if it is suitable for docking. More...
 
bool RiverModifyDesertZone (TileIndex tile, void *data)
 Callback to create non-desert around a river tile.
 
void MakeRiverAndModifyDesertZoneAround (TileIndex tile)
 Make a river tile and remove desert directly around it. More...
 
bool IsWateredTile (TileIndex tile, Direction from)
 return true if a tile is a water tile wrt. More...
 
Money CanalMaintenanceCost (uint32_t num)
 Calculates the maintenance cost of a number of canal tiles. More...
 

Variables

static const uint RIVER_OFFSET_DESERT_DISTANCE = 5
 Circular tile search radius to create non-desert around a river tile.
 

Detailed Description

Functions related to water (management)

Definition in file water.h.

Enumeration Type Documentation

◆ FloodingBehaviour

Describes the behaviour of a tile during flooding.

Enumerator
FLOOD_NONE 

The tile does not flood neighboured tiles.

FLOOD_ACTIVE 

The tile floods neighboured tiles.

FLOOD_PASSIVE 

The tile does not actively flood neighboured tiles, but it prevents them from drying up.

FLOOD_DRYUP 

The tile drys up if it is not constantly flooded from neighboured tiles.

Definition at line 19 of file water.h.

Function Documentation

◆ CanalMaintenanceCost()

Money CanalMaintenanceCost ( uint32_t  num)
inline

Calculates the maintenance cost of a number of canal tiles.

Parameters
numNumber of canal tiles.
Returns
Total cost.

Definition at line 52 of file water.h.

◆ CheckForDockingTile()

void CheckForDockingTile ( TileIndex  t)

Mark the supplied tile as a docking tile if it is suitable for docking.

Tiles surrounding the tile are tested to be docks with correct orientation.

Parameters
tTile to test.

Definition at line 184 of file water_cmd.cpp.

References OrthogonalTileArea::Add(), DIAGDIR_BEGIN, DIAGDIR_END, Station::docking_station, Industry::GetByTile(), SpecializedStation< Station, false >::GetByTile(), IsDockTile(), IsDockWaterPart(), IsOilRig(), IsTileType(), IsValidTile(), MP_INDUSTRY, MP_STATION, Industry::neutral_station, SetDockingTile(), and TileOffsByDiagDir().

◆ FloodHalftile()

bool FloodHalftile ( TileIndex  t)

Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore.

The function floods the lower halftile, if the tile has a halftile foundation.

Parameters
tThe tile to flood.
Returns
true if something was flooded.

Definition at line 762 of file rail_cmd.cpp.

References IsPlainRailTile().

Referenced by DoFloodTile().

◆ GetFloodingBehaviour()

FloodingBehaviour GetFloodingBehaviour ( TileIndex  tile)

Returns the behaviour of a tile during flooding.

Returns
Behaviour of the tile

Definition at line 1078 of file water_cmd.cpp.

References FLOOD_ACTIVE, FLOOD_DRYUP, FLOOD_NONE, GetTileSlope(), GetTileType(), GetWaterClass(), IsCoast(), IsSlopeWithOneCornerRaised(), MP_INDUSTRY, MP_OBJECT, MP_RAILWAY, MP_STATION, MP_WATER, and WATER_CLASS_SEA.

Referenced by CheckRailSlope(), and TileLoop_Water().

◆ IsWateredTile()

bool IsWateredTile ( TileIndex  tile,
Direction  from 
)

return true if a tile is a water tile wrt.

a certain direction.

Parameters
tileThe tile of interest.
fromThe direction of interest.
Returns
true iff the tile is water in the view of 'from'.

Definition at line 622 of file water_cmd.cpp.

References GetTileType(), GetWaterTileType(), and MP_WATER.

Referenced by CanalScopeResolver::GetVariable().

◆ 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 442 of file water_cmd.cpp.

References MakeRiver().

Referenced by RiverMakeWider().

◆ TileLoop_Water()

void TileLoop_Water ( TileIndex  tile)

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

Parameters
tilethe water/shore tile that floods

Definition at line 1231 of file water_cmd.cpp.

References _flood_from_dirs, AmbientSoundEffect(), DIR_BEGIN, DIR_END, DoDryUp(), DoFloodTile(), FLOOD_ACTIVE, FLOOD_DRYUP, FLOOD_PASSIVE, GetFloodingBehaviour(), GetFoundationSlope(), GetTreeGround(), HasBit(), IsTileType(), IsValidTile(), MP_TREES, MP_WATER, ReverseDir(), Map::Size(), SLOPE_HALFTILE_MASK, SLOPE_STEEP, TileOffsByDir(), and TREE_GROUND_SHORE.