# water.h File Reference

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

Go to the source code of this file.

## Functions

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 | ConvertGroundTilesIntoWaterTiles ()
void | DrawShipDepotSprite (int x, int y, int image)
void | DrawWaterClassGround (const struct TileInfo *ti)
void | DrawShoreTile (Slope tileh)
void | MakeWaterKeepingClass (TileIndex tile, Owner o)
void | SetWaterClassDependingOnSurroundings (TileIndex t)
| Makes a tile canal or water depending on the surroundings.

## Detailed Description

Functions related to water (management).

Definition in file water.h.

## Function Documentation

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 540 of file rail_cmd.cpp.

References CMD_REMOVE_SINGLE_RAIL, CmdFailed(), CornerToTrackBits(), DC_EXEC, DoCommand(), FIND_FIRST_BIT, GetHighestSlopeCorner(), GetRailFoundation(), GetTrackBits(), IsNonContinuousFoundation(), IsSlopeWithOneCornerRaised(), IsSlopeWithThreeCornersRaised(), IsSteepSlope(), MarkTileDirtyByTile(), OppositeCorner(), OWNER_WATER, and RAIL_GROUND_WATER.

Referenced by DoFloodTile().

void SetWaterClassDependingOnSurroundings | ( | TileIndex | t | ) |

Makes a tile canal or water depending on the surroundings.

Must only be used for converting old savegames. Use WaterClass now.

This as for example docks and shipdepots do not store whether the tile used to be canal or 'normal' water.

Parameters:

  | t | the tile to change.
  | o | the owner of the new tile.

Definition at line 107 of file water_cmd.cpp.

References DIAGDIR_BEGIN, DIAGDIR_END, GetTileType(), GetTreeGround(), MapMaxX(), MapMaxY(), MarkTileDirtyByTile(), MP_RAILWAY, MP_TREES, MP_WATER, RAIL_GROUND_WATER, SLOPE_FLAT, TileAddByDiagDir(), TileX(), TileY(), and TREE_GROUND_SHORE.

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

References _flood_from_dirs, AddTileIndexDiffCWrap(), DIR_BEGIN, DIR_END, DoDryUp(), DoFloodTile(), FLOOD_ACTIVE, FLOOD_DRYUP, FLOOD_PASSIVE, FOR_EACH_SET_BIT, GetFloodingBehaviour(), HasBit(), INVALID_TILE, IsTileType(), MP_WATER, ReverseDir(), SLOPE_HALFTILE_MASK, SLOPE_STEEP, and TileIndexDiffCByDir().