# water_map.h File Reference

Map accessors for water tiles. More...

`#include "core/math_func.hpp"`
`#include "depot_type.h"`
`#include "tile_map.h"`

Go to the source code of this file.

## Enumerations

enum | WaterTileType { WATER_TILE_CLEAR, WATER_TILE_COAST, WATER_TILE_LOCK, WATER_TILE_DEPOT }
enum | WaterClass { WATER_CLASS_SEA, WATER_CLASS_CANAL, WATER_CLASS_RIVER, WATER_CLASS_INVALID }
enum | DepotPart { DEPOT_NORTH = 0x80, DEPOT_SOUTH = 0x81, DEPOT_END = 0x84 }
enum | LockPart { LOCK_MIDDLE = 0x10, LOCK_LOWER = 0x14, LOCK_UPPER = 0x18, LOCK_END = 0x1C }

## Functions

static WaterTileType | GetWaterTileType (TileIndex t)
static WaterClass | GetWaterClass (TileIndex t)
static void | SetWaterClass (TileIndex t, WaterClass wc)
static bool | IsWater (TileIndex t)
| IsWater return true if any type of clear water like ocean, river, canal.
static bool | IsSea (TileIndex t)
static bool | IsCanal (TileIndex t)
static bool | IsRiver (TileIndex t)
static bool | IsWaterTile (TileIndex t)
static bool | IsCoast (TileIndex t)
static TileIndex | GetOtherShipDepotTile (TileIndex t)
static bool | IsShipDepot (TileIndex t)
static bool | IsShipDepotTile (TileIndex t)
static Axis | GetShipDepotAxis (TileIndex t)
static DiagDirection | GetShipDepotDirection (TileIndex t)
static bool | IsLock (TileIndex t)
static DiagDirection | GetLockDirection (TileIndex t)
static byte | GetSection (TileIndex t)
static byte | GetWaterTileRandomBits (TileIndex t)
static void | MakeShore (TileIndex t)
static void | MakeWater (TileIndex t, Owner o, WaterClass wc, uint8 random_bits)
| Helper function for making a watery tile.
static void | MakeSea (TileIndex t)
| Make a sea tile.
static void | MakeRiver (TileIndex t, uint8 random_bits)
| Make a river tile.
static void | MakeCanal (TileIndex t, Owner o, uint8 random_bits)
| Make a canal tile.
static void | MakeShipDepot (TileIndex t, Owner o, DepotID did, DepotPart base, Axis a, WaterClass original_water_class)
static void | MakeLockTile (TileIndex t, Owner o, byte section, WaterClass original_water_class)
static void | MakeLock (TileIndex t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper)

## Detailed Description

Map accessors for water tiles.

Definition in file water_map.h.

## Enumeration Type Documentation

enum WaterClass

Enumerator:

  WATER_CLASS_INVALID | Used for industry tiles on land (also for oilrig if newgrf says so).

Definition at line 26 of file water_map.h.

## Function Documentation

static void MakeCanal | ( | TileIndex | t,
|  | Owner | o,
|  | uint8 | random_bits |
| ) |  |  | `[inline, static]`

Make a canal tile.

Parameters:

  | t | The tile to change into canal
  | o | The owner of the canal
  | random_bits | Random bits to be set for this tile

Definition at line 208 of file water_map.h.

References MakeWater(), and OWNER_WATER.

Referenced by CmdBuildCanal().

static void MakeRiver | ( | TileIndex | t,
|  | uint8 | random_bits |
| ) |  |  | `[inline, static]`

Make a river tile.

Parameters:

  | t | The tile to change into river
  | random_bits | Random bits to be set for this tile

Definition at line 197 of file water_map.h.

References MakeWater(), and OWNER_WATER.

Referenced by CmdBuildCanal().

static void MakeSea | ( | TileIndex | t | ) | `[inline, static]`

Make a sea tile.

Parameters:

  | t | The tile to change into sea

Definition at line 187 of file water_map.h.

References MakeWater(), and OWNER_WATER.

Referenced by CmdBuildCanal(), and DoFloodTile().

static void MakeWater | ( | TileIndex | t,
|  | Owner | o,
|  | WaterClass | wc,
|  | uint8 | random_bits |
| ) |  |  | `[inline, static]`

Helper function for making a watery tile.

Parameters:

  | t | The tile to change into water
  | o | The owner of the water
  | wc | The class of water the tile has to be
  | random_bits | Eventual random bits to be set for this tile

Definition at line 171 of file water_map.h.

References _m, _me, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MP_WATER, SB(), SetTileOwner(), and SetTileType().

Referenced by MakeCanal(), MakeRiver(), and MakeSea().