Enumerations | Functions

# water.h File Reference

Functions related to water (management). More...

`#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.
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().
bool | FloodHalftile (TileIndex t)
| Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore.
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)
bool | RiverModifyDesertZone (TileIndex tile, void *data)
| Callback to create non-desert around a river tile.
bool | IsWateredTile (TileIndex tile, Direction from)
| return true if a tile is a water tile wrt.
static Money | CanalMaintenanceCost (uint32 num)
| Calculates the maintenance cost of a number of canal tiles.

## Detailed Description

Functions related to water (management).

Definition in file water.h.

## Enumeration Type Documentation

enum 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 21 of file water.h.

## Function Documentation

static Money CanalMaintenanceCost | ( | uint32 | num | ) | `[inline, static]`

Calculates the maintenance cost of a number of canal tiles.

Parameters:

  | num | Number of canal tiles.

Returns:
  Total cost.

Definition at line 51 of file water.h.

References IntSqrt().

Referenced by CompaniesGenStatistics(), CompanyInfrastructureWindow::DrawWidget(), CompanyInfrastructureWindow::GetTotalMaintenanceCost(), and CompanyInfrastructureWindow::UpdateWidgetSize().

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:

  | t | The tile to flood.

Returns:
  true if something was flooded.

Definition at line 716 of file rail_cmd.cpp.

References _current_company, ApplyFoundationToSlope(), CMD_REMOVE_SINGLE_RAIL, CornerToTrackBits(), DC_EXEC, DoCommand(), FIND_FIRST_BIT, GetHighestSlopeCorner(), GetRailFoundation(), GetTileSlope(), GetTrackBits(), IsNonContinuousFoundation(), IsPlainRailTile(), IsSlopeWithOneCornerRaised(), IsSlopeWithThreeCornersRaised(), IsSteepSlope(), MakeShore(), MarkTileDirtyByTile(), OppositeCorner(), OWNER_WATER, RAIL_GROUND_WATER, Backup< T >::Restore(), and CommandCost::Succeeded().

Referenced by DoFloodTile().

FloodingBehaviour GetFloodingBehaviour | ( | TileIndex | tile | ) |

Returns the behaviour of a tile during flooding.

Returns:
  Behaviour of the tile

Definition at line 1008 of file water_cmd.cpp.

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

Referenced by CheckRailSlope(), and TileLoop_Water().

bool IsWateredTile | ( | TileIndex | tile,
|  | Direction | from |
| ) |  |  |

return true if a tile is a water tile wrt.

a certain direction.

Parameters:

  | tile | The tile of interest.
  | from | The direction of interest.

Returns:
  true iff the tile is water in the view of 'from'.

Definition at line 551 of file water_cmd.cpp.

References DiagDirToAxis(), DIR_NE, DIR_NW, DIR_SE, DIR_SW, DirToDiagDir(), GetIndustryIndex(), GetLockDirection(), GetTileSlope(), GetTileType(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), GetWaterTileType(), IsBuoy(), IsDock(), IsOilRig(), IsPlainRail(), IsTileFlat(), IsTileOnWater(), IsTileType(), MP_INDUSTRY, MP_OBJECT, MP_RAILWAY, MP_STATION, MP_TUNNELBRIDGE, MP_VOID, MP_WATER, ReverseDiagDir(), SLOPE_E, SLOPE_N, SLOPE_S, SLOPE_W, TileOffsByDir(), TRANSPORT_WATER, WATER_TILE_CLEAR, WATER_TILE_COAST, WATER_TILE_DEPOT, and WATER_TILE_LOCK.

Referenced by DrawWaterEdges(), and CanalScopeResolver::GetVariable().

bool RiverModifyDesertZone | ( | TileIndex | tile,
|  | void * |  |
| ) |  |  |

Callback to create non-desert around a river tile.

Definition at line 382 of file water_cmd.cpp.

References GetTropicZone(), SetTropicZone(), TROPICZONE_DESERT, and TROPICZONE_NORMAL.

Referenced by CmdBuildCanal().

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:

  | tile | the water/shore tile that floods

Definition at line 1156 of file water_cmd.cpp.

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