OpenTTD Source 20241224-master-gf74b0cf984
water_map.h File Reference

Map accessors for water tiles. More...

#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 }
 Available water tile types. More...
 
enum  WaterClass : uint8_t { WATER_CLASS_SEA , WATER_CLASS_CANAL , WATER_CLASS_RIVER , WATER_CLASS_INVALID }
 classes of water (for WATER_TILE_CLEAR water tile type). More...
 
enum  DepotPart { DEPOT_PART_NORTH = 0 , DEPOT_PART_SOUTH = 1 , DEPOT_PART_END }
 Sections of the water depot. More...
 
enum  LockPart { LOCK_PART_MIDDLE = 0 , LOCK_PART_LOWER = 1 , LOCK_PART_UPPER = 2 }
 Sections of the water lock. More...
 

Functions

bool IsValidWaterClass (WaterClass wc)
 Checks if a water class is valid.
 
bool IsPossibleDockingTile (Tile t)
 
WaterTileType GetWaterTileType (Tile t)
 Get the water tile type of a tile.
 
void SetWaterTileType (Tile t, WaterTileType type)
 Set the water tile type of a tile.
 
bool HasTileWaterClass (Tile t)
 Checks whether the tile has an waterclass associated.
 
WaterClass GetWaterClass (Tile t)
 Get the water class at a tile.
 
void SetWaterClass (Tile t, WaterClass wc)
 Set the water class at a tile.
 
bool IsTileOnWater (Tile t)
 Tests if the tile was built on water.
 
bool IsWater (Tile t)
 Is it a plain water tile?
 
bool IsSea (Tile t)
 Is it a sea water tile?
 
bool IsCanal (Tile t)
 Is it a canal tile?
 
bool IsRiver (Tile t)
 Is it a river water tile?
 
bool IsWaterTile (Tile t)
 Is it a water tile with plain water?
 
bool IsCoast (Tile t)
 Is it a coast tile?
 
bool IsCoastTile (Tile t)
 Is it a coast tile.
 
bool IsShipDepot (Tile t)
 Is it a water tile with a ship depot on it?
 
bool IsShipDepotTile (Tile t)
 Is it a ship depot tile?
 
Axis GetShipDepotAxis (Tile t)
 Get the axis of the ship depot.
 
DepotPart GetShipDepotPart (Tile t)
 Get the part of a ship depot.
 
DiagDirection GetShipDepotDirection (Tile t)
 Get the direction of the ship depot.
 
TileIndex GetOtherShipDepotTile (Tile t)
 Get the other tile of the ship depot.
 
TileIndex GetShipDepotNorthTile (Tile t)
 Get the most northern tile of a ship depot.
 
bool IsLock (Tile t)
 Is there a lock on a given water tile?
 
DiagDirection GetLockDirection (Tile t)
 Get the direction of the water lock.
 
uint8_t GetLockPart (Tile t)
 Get the part of a lock.
 
uint8_t GetWaterTileRandomBits (Tile t)
 Get the random bits of the water tile.
 
bool HasTileWaterGround (Tile t)
 Checks whether the tile has water at the ground.
 
void SetDockingTile (Tile t, bool b)
 Set the docking tile state of a tile.
 
bool IsDockingTile (Tile t)
 Checks whether the tile is marked as a dockling tile.
 
void MakeShore (Tile t)
 Helper function to make a coast tile.
 
void MakeWater (Tile t, Owner o, WaterClass wc, uint8_t random_bits)
 Helper function for making a watery tile.
 
void MakeSea (Tile t)
 Make a sea tile.
 
void MakeRiver (Tile t, uint8_t random_bits)
 Make a river tile.
 
void MakeCanal (Tile t, Owner o, uint8_t random_bits)
 Make a canal tile.
 
void MakeShipDepot (Tile t, Owner o, DepotID did, DepotPart part, Axis a, WaterClass original_water_class)
 Make a ship depot section.
 
void MakeLockTile (Tile t, Owner o, LockPart part, DiagDirection dir, WaterClass original_water_class)
 Make a lock section.
 
void MakeLock (Tile t, Owner o, DiagDirection d, WaterClass wc_lower, WaterClass wc_upper, WaterClass wc_middle)
 Make a water lock.
 
void SetNonFloodingWaterTile (Tile t, bool b)
 Set the non-flooding water tile state of a tile.
 
bool IsNonFloodingWaterTile (Tile t)
 Checks whether the tile is marked as a non-flooding water tile.
 

Variables

static constexpr uint8_t WBL_TYPE_BEGIN = 4
 Bit field layout of m5 for water tiles.
 
static constexpr uint8_t WBL_TYPE_COUNT = 4
 Length of the 'type' bitfield.
 
static constexpr uint8_t WBL_LOCK_ORIENT_BEGIN = 0
 Start of lock orientation bitfield.
 
static constexpr uint8_t WBL_LOCK_ORIENT_COUNT = 2
 Length of lock orientation bitfield.
 
static constexpr uint8_t WBL_LOCK_PART_BEGIN = 2
 Start of lock part bitfield.
 
static constexpr uint8_t WBL_LOCK_PART_COUNT = 2
 Length of lock part bitfield.
 
static constexpr uint8_t WBL_DEPOT_PART = 0
 Depot part flag.
 
static constexpr uint8_t WBL_DEPOT_AXIS = 1
 Depot axis flag.
 

Detailed Description

Map accessors for water tiles.

Definition in file water_map.h.

Enumeration Type Documentation

◆ DepotPart

enum DepotPart

Sections of the water depot.

Enumerator
DEPOT_PART_NORTH 

Northern part of a depot.

DEPOT_PART_SOUTH 

Southern part of a depot.

Definition at line 58 of file water_map.h.

◆ LockPart

enum LockPart

Sections of the water lock.

Enumerator
LOCK_PART_MIDDLE 

Middle part of a lock.

LOCK_PART_LOWER 

Lower part of a lock.

LOCK_PART_UPPER 

Upper part of a lock.

Definition at line 65 of file water_map.h.

◆ WaterClass

enum WaterClass : uint8_t

classes of water (for WATER_TILE_CLEAR water tile type).

Enumerator
WATER_CLASS_SEA 

Sea.

WATER_CLASS_CANAL 

Canal.

WATER_CLASS_RIVER 

River.

WATER_CLASS_INVALID 

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

Definition at line 39 of file water_map.h.

◆ WaterTileType

Available water tile types.

Enumerator
WATER_TILE_CLEAR 

Plain water.

WATER_TILE_COAST 

Coast.

WATER_TILE_LOCK 

Water lock.

WATER_TILE_DEPOT 

Water Depot.

Definition at line 31 of file water_map.h.

Function Documentation

◆ GetLockDirection()

DiagDirection GetLockDirection ( Tile  t)
inline

Get the direction of the water lock.

Parameters
tWater tile to query.
Returns
Direction of the lock.
Precondition
IsTileType(t, MP_WATER) && IsLock(t)

Definition at line 314 of file water_map.h.

References GB(), IsLock(), Tile::m5(), WBL_LOCK_ORIENT_BEGIN, and WBL_LOCK_ORIENT_COUNT.

Referenced by DrawWaterLock(), IsWateredTile(), and RemoveLock().

◆ GetLockPart()

uint8_t GetLockPart ( Tile  t)
inline

Get the part of a lock.

Parameters
tWater tile to query.
Returns
The part.
Precondition
IsTileType(t, MP_WATER) && IsLock(t)

Definition at line 326 of file water_map.h.

References GB(), IsLock(), Tile::m5(), WBL_LOCK_PART_BEGIN, and WBL_LOCK_PART_COUNT.

Referenced by AfterLoadGame(), DrawWaterLock(), CanalScopeResolver::GetVariable(), and ShipTestUpDownOnLock().

◆ GetOtherShipDepotTile()

TileIndex GetOtherShipDepotTile ( Tile  t)
inline

Get the other tile of the ship depot.

Parameters
tTile to query, containing one section of a ship depot.
Returns
Tile containing the other section of the depot.
Precondition
IsShipDepotTile(t)

Definition at line 278 of file water_map.h.

References DEPOT_PART_NORTH, GetShipDepotAxis(), GetShipDepotPart(), and TileOffsByAxis().

Referenced by AfterLoadGame(), and GetShipDepotNorthTile().

◆ GetShipDepotAxis()

Axis GetShipDepotAxis ( Tile  t)
inline

Get the axis of the ship depot.

Parameters
tWater tile to query.
Returns
Axis of the depot.
Precondition
IsShipDepotTile(t)

Definition at line 243 of file water_map.h.

References GB(), IsShipDepotTile(), Tile::m5(), and WBL_DEPOT_AXIS.

Referenced by DrawWaterDepot(), GetOtherShipDepotTile(), and GetShipDepotDirection().

◆ GetShipDepotDirection()

DiagDirection GetShipDepotDirection ( Tile  t)
inline

Get the direction of the ship depot.

Parameters
tWater tile to query.
Returns
Direction of the depot.
Precondition
IsShipDepotTile(t)

Definition at line 267 of file water_map.h.

References GetShipDepotAxis(), GetShipDepotPart(), and XYNSToDiagDir().

Referenced by Ship::GetVehicleTrackdir().

◆ GetShipDepotNorthTile()

TileIndex GetShipDepotNorthTile ( Tile  t)
inline

Get the most northern tile of a ship depot.

Parameters
tOne of the tiles of the ship depot.
Returns
The northern tile of the depot.
Precondition
IsShipDepotTile(t)

Definition at line 289 of file water_map.h.

References GetOtherShipDepotTile(), and IsShipDepot().

Referenced by CmdBuildShip().

◆ GetShipDepotPart()

DepotPart GetShipDepotPart ( Tile  t)
inline

Get the part of a ship depot.

Parameters
tWater tile to query.
Returns
Part of the depot.
Precondition
IsShipDepotTile(t)

Definition at line 255 of file water_map.h.

References GB(), IsShipDepotTile(), Tile::m5(), and WBL_DEPOT_PART.

Referenced by DrawWaterDepot(), GetOtherShipDepotTile(), and GetShipDepotDirection().

◆ GetWaterClass()

WaterClass GetWaterClass ( Tile  t)
inline

Get the water class at a tile.

Parameters
tWater tile to query.
Precondition
IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT)
Returns
Water class at the tile.

Definition at line 112 of file water_map.h.

References GB(), HasTileWaterClass(), and Tile::m1().

Referenced by AfterLoadGame(), AmbientSoundEffectCallback(), BuildObject(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildShipDepot(), CmdLandscapeClear(), DoBuildLock(), DoCreateNewIndustry(), DrawTile_TunnelBridge(), GetEffectiveWaterClass(), GetFloodingBehaviour(), GetNearbyTileInformation(), IsCanal(), IsCoastTile(), IsRiver(), IsSea(), IsTileOnWater(), NeighbourIsNormal(), RemoveLock(), and SetWaterClassDependingOnSurroundings().

◆ GetWaterTileRandomBits()

uint8_t GetWaterTileRandomBits ( Tile  t)
inline

Get the random bits of the water tile.

Parameters
tWater tile to query.
Returns
Random bits of the tile.
Precondition
IsTileType(t, MP_WATER)

Definition at line 338 of file water_map.h.

References IsTileType(), Tile::m4(), and MP_WATER.

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

◆ GetWaterTileType()

WaterTileType GetWaterTileType ( Tile  t)
inline

Get the water tile type of a tile.

Parameters
tWater tile to query.
Returns
Water tile type at the tile.

Definition at line 78 of file water_map.h.

References GB(), IsTileType(), Tile::m5(), MP_WATER, WBL_TYPE_BEGIN, and WBL_TYPE_COUNT.

Referenced by AfterLoadGame(), IsCoast(), IsLock(), IsShipDepot(), IsWater(), and IsWateredTile().

◆ HasTileWaterClass()

bool HasTileWaterClass ( Tile  t)
inline

Checks whether the tile has an waterclass associated.

You can then subsequently call GetWaterClass().

Parameters
tTile to query.
Returns
True if the tiletype has a waterclass.

Definition at line 101 of file water_map.h.

References IsTileType(), MP_INDUSTRY, MP_OBJECT, MP_STATION, MP_TREES, and MP_WATER.

Referenced by AmbientSoundEffectCallback(), CheckIfIndustryTilesAreFree(), CmdBuildDock(), CmdBuildShipDepot(), CmdLandscapeClear(), DrawTile_TunnelBridge(), GetEffectiveWaterClass(), GetNearbyTileInformation(), GetWaterClass(), HasTileWaterGround(), NeighbourIsNormal(), and SetWaterClass().

◆ HasTileWaterGround()

bool HasTileWaterGround ( Tile  t)
inline

Checks whether the tile has water at the ground.

That is, it is either some plain water tile, or a object/industry/station/... with water under it.

Returns
true iff the tile has water at the ground.
Note
Coast tiles are not considered waterish, even if there is water on a halftile.

Definition at line 350 of file water_map.h.

References HasTileWaterClass(), IsCoastTile(), and IsTileOnWater().

Referenced by BuildObject(), CanFollowRoad(), CmdBuildBuoy(), CmdBuildDock(), CmdBuildObject(), CmdBuildShipDepot(), CmdBuildTunnel(), DoBuildLock(), GetClosestWaterDistance(), and GrowTownInTile().

◆ IsCanal()

bool IsCanal ( Tile  t)
inline

Is it a canal tile?

Parameters
tWater tile to query.
Returns
true if it is a canal tile.
Precondition
IsTileType(t, MP_WATER)

Definition at line 169 of file water_map.h.

References GetWaterClass(), IsWater(), and WATER_CLASS_CANAL.

Referenced by CmdBuildCanal(), CmdLandscapeClear(), and MarkTileDirtyIfCanalOrRiver().

◆ IsCoast()

bool IsCoast ( Tile  t)
inline

Is it a coast tile?

Parameters
tWater tile to query.
Returns
true if it is a sea water tile.
Precondition
IsTileType(t, MP_WATER)

Definition at line 201 of file water_map.h.

References GetWaterTileType(), and WATER_TILE_COAST.

Referenced by CanPlantTreesOnTile(), CmdBuildBridge(), CmdPlantTree(), DoDryUp(), GetFloodingBehaviour(), IsCoastTile(), and SetWaterClassDependingOnSurroundings().

◆ IsCoastTile()

bool IsCoastTile ( Tile  t)
inline

Is it a coast tile.

Parameters
tTile to query.
Returns
true if it is a coast.

Definition at line 211 of file water_map.h.

References GetWaterClass(), IsCoast(), IsTileType(), MP_TREES, MP_WATER, and WATER_CLASS_INVALID.

Referenced by CmdLandscapeClear(), and HasTileWaterGround().

◆ IsDockingTile()

bool IsDockingTile ( Tile  t)
inline

Checks whether the tile is marked as a dockling tile.

Returns
true iff the tile is marked as a docking tile.

Definition at line 371 of file water_map.h.

References HasBit(), IsTileType(), Tile::m1(), MP_RAILWAY, MP_STATION, MP_TUNNELBRIDGE, and MP_WATER.

Referenced by BuildObject(), CheckCaches(), CmdRemoveSingleRail(), IsShipDestinationTile(), CYapfCostShipT< Types >::PfCalcCost(), and RemoveDock().

◆ IsLock()

bool IsLock ( Tile  t)
inline

Is there a lock on a given water tile?

Parameters
tWater tile to query.
Returns
true if it is a water lock tile.
Precondition
IsTileType(t, MP_WATER)

Definition at line 303 of file water_map.h.

References GetWaterTileType(), and WATER_TILE_LOCK.

Referenced by AfterLoadGame(), GetLockDirection(), GetLockPart(), CanalScopeResolver::GetVariable(), SetWaterClassDependingOnSurroundings(), and ShipTestUpDownOnLock().

◆ IsNonFloodingWaterTile()

bool IsNonFloodingWaterTile ( Tile  t)
inline

Checks whether the tile is marked as a non-flooding water tile.

Returns
true iff the tile is marked as a non-flooding water tile.

Definition at line 533 of file water_map.h.

References HasBit(), IsTileType(), Tile::m3(), and MP_WATER.

Referenced by TileLoop_Water().

◆ IsPossibleDockingTile()

bool IsPossibleDockingTile ( Tile  t)

Definition at line 173 of file water_cmd.cpp.

◆ IsRiver()

bool IsRiver ( Tile  t)
inline

Is it a river water tile?

Parameters
tWater tile to query.
Returns
true if it is a river water tile.
Precondition
IsTileType(t, MP_WATER)

Definition at line 180 of file water_map.h.

References GetWaterClass(), IsWater(), and WATER_CLASS_RIVER.

Referenced by MarkTileDirtyIfCanalOrRiver(), and RiverMakeWider().

◆ IsSea()

bool IsSea ( Tile  t)
inline

Is it a sea water tile?

Parameters
tWater tile to query.
Returns
true if it is a sea water tile.
Precondition
IsTileType(t, MP_WATER)

Definition at line 158 of file water_map.h.

References GetWaterClass(), IsWater(), and WATER_CLASS_SEA.

Referenced by GrowTownWithBridge().

◆ IsShipDepot()

bool IsShipDepot ( Tile  t)
inline

Is it a water tile with a ship depot on it?

Parameters
tWater tile to query.
Returns
true if it is a ship depot tile.
Precondition
IsTileType(t, MP_WATER)

Definition at line 222 of file water_map.h.

References GetWaterTileType(), and WATER_TILE_DEPOT.

Referenced by AfterLoadGame(), GetShipDepotNorthTile(), and IsShipDepotTile().

◆ IsShipDepotTile()

bool IsShipDepotTile ( Tile  t)
inline

Is it a ship depot tile?

Parameters
tTile to query.
Returns
true if it is a ship depot tile.

Definition at line 232 of file water_map.h.

References IsShipDepot(), IsTileType(), and MP_WATER.

Referenced by AfterLoadGame(), CmdInsertOrder(), GetDepotIndex(), GetShipDepotAxis(), GetShipDepotPart(), IsDepotTile(), and IsDepotTypeTile().

◆ IsTileOnWater()

bool IsTileOnWater ( Tile  t)
inline

Tests if the tile was built on water.

Parameters
tthe tile to check
Precondition
IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT)
Returns
true iff on water

Definition at line 136 of file water_map.h.

References GetWaterClass(), and WATER_CLASS_INVALID.

Referenced by CheckIfIndustryTilesAreFree(), CmdLandscapeClear(), DrawTileLayout(), SmallMapWindow::GetTileColours(), HasTileWaterGround(), and IsWateredTile().

◆ IsValidWaterClass()

bool IsValidWaterClass ( WaterClass  wc)
inline

Checks if a water class is valid.

Parameters
wcThe value to check
Returns
true if the given value is a valid water class.

Definition at line 52 of file water_map.h.

References WATER_CLASS_INVALID.

Referenced by CmdBuildCanal().

◆ IsWater()

bool IsWater ( Tile  t)
inline

Is it a plain water tile?

Parameters
tWater tile to query.
Returns
true if any type of clear water like ocean, river, or canal.
Precondition
IsTileType(t, MP_WATER)

Definition at line 147 of file water_map.h.

References GetWaterTileType(), and WATER_TILE_CLEAR.

Referenced by AfterLoadGame(), CleanUpRoadBits(), CmdBuildBridge(), CMSAWater(), IsCanal(), IsRiver(), IsSea(), and IsWaterTile().

◆ IsWaterTile()

bool IsWaterTile ( Tile  t)
inline

Is it a water tile with plain water?

Parameters
tTile to query.
Returns
true if it is a plain water tile.

Definition at line 190 of file water_map.h.

References IsTileType(), IsWater(), and MP_WATER.

Referenced by BuildObject(), CheckIfIndustryTilesAreFree(), CmdBuildBuoy(), CmdBuildCanal(), CmdBuildDock(), CmdBuildObject(), CmdBuildShipDepot(), CmdLandscapeClear(), DoBuildLock(), DoCreateNewIndustry(), FindSpring(), FlowRiver(), GrowTownWithBridge(), MakeLake(), MakeLock(), and RiverMakeWider().

◆ MakeCanal()

void MakeCanal ( Tile  t,
Owner  o,
uint8_t  random_bits 
)
inline

Make a canal tile.

Parameters
tThe tile to change into canal
oThe owner of the canal
random_bitsRandom bits to be set for this tile

Definition at line 443 of file water_map.h.

References MakeWater(), OWNER_WATER, and WATER_CLASS_CANAL.

Referenced by AfterLoadGame(), and CmdBuildCanal().

◆ MakeLock()

void MakeLock ( Tile  t,
Owner  o,
DiagDirection  d,
WaterClass  wc_lower,
WaterClass  wc_upper,
WaterClass  wc_middle 
)
inline

Make a water lock.

Parameters
tTile to place the water lock section.
oOwner of the lock.
dDirection of the water lock.
wc_lowerOriginal water class of the lower part.
wc_upperOriginal water class of the upper part.
wc_middleOriginal water class of the middle part.

Definition at line 506 of file water_map.h.

References GetTileOwner(), IsWaterTile(), LOCK_PART_LOWER, LOCK_PART_MIDDLE, LOCK_PART_UPPER, MakeLockTile(), and TileOffsByDiagDir().

Referenced by DoBuildLock().

◆ MakeLockTile()

void MakeLockTile ( Tile  t,
Owner  o,
LockPart  part,
DiagDirection  dir,
WaterClass  original_water_class 
)
inline

Make a lock section.

Parameters
tTile to place the water lock section.
oOwner of the lock.
partPart to place.
dirLock orientation
original_water_classOriginal water class.
See also
MakeLock

Definition at line 482 of file water_map.h.

References Tile::m2(), Tile::m3(), Tile::m4(), Tile::m5(), Tile::m6(), Tile::m7(), MP_WATER, SB(), SetDockingTile(), SetTileOwner(), SetTileType(), SetWaterClass(), SetWaterTileType(), WATER_TILE_LOCK, WBL_LOCK_ORIENT_BEGIN, and WBL_LOCK_PART_BEGIN.

Referenced by MakeLock().

◆ MakeRiver()

void MakeRiver ( Tile  t,
uint8_t  random_bits 
)
inline

Make a river tile.

Parameters
tThe tile to change into river
random_bitsRandom bits to be set for this tile

Definition at line 432 of file water_map.h.

References MakeWater(), OWNER_WATER, and WATER_CLASS_RIVER.

Referenced by CmdBuildCanal(), MakeRiverAndModifyDesertZoneAround(), and RemoveLock().

◆ MakeSea()

void MakeSea ( Tile  t)
inline

Make a sea tile.

Parameters
tThe tile to change into sea

Definition at line 422 of file water_map.h.

References MakeWater(), OWNER_WATER, and WATER_CLASS_SEA.

Referenced by AfterLoadGame(), CmdBuildCanal(), and DoFloodTile().

◆ MakeShipDepot()

void MakeShipDepot ( Tile  t,
Owner  o,
DepotID  did,
DepotPart  part,
Axis  a,
WaterClass  original_water_class 
)
inline

Make a ship depot section.

Parameters
tTile to place the ship depot section.
oOwner of the depot.
didDepot ID.
partDepot part (either DEPOT_PART_NORTH or DEPOT_PART_SOUTH).
aAxis of the depot.
original_water_classOriginal water class.

Definition at line 458 of file water_map.h.

References Tile::m2(), Tile::m3(), Tile::m4(), Tile::m5(), Tile::m6(), Tile::m7(), MP_WATER, SB(), SetDockingTile(), SetTileOwner(), SetTileType(), SetWaterClass(), SetWaterTileType(), WATER_TILE_DEPOT, WBL_DEPOT_AXIS, and WBL_DEPOT_PART.

Referenced by CmdBuildShipDepot().

◆ MakeShore()

void MakeShore ( Tile  t)
inline

Helper function to make a coast tile.

Parameters
tThe tile to change into water

Definition at line 381 of file water_map.h.

References Tile::m2(), Tile::m3(), Tile::m4(), Tile::m5(), Tile::m6(), Tile::m7(), MP_WATER, OWNER_WATER, SB(), SetDockingTile(), SetTileOwner(), SetTileType(), SetWaterClass(), SetWaterTileType(), WATER_CLASS_SEA, and WATER_TILE_COAST.

Referenced by AfterLoadGame(), CmdRemoveSingleRail(), DoFloodTile(), and FloodHalftile().

◆ MakeWater()

void MakeWater ( Tile  t,
Owner  o,
WaterClass  wc,
uint8_t  random_bits 
)
inline

Helper function for making a watery tile.

Parameters
tThe tile to change into water
oThe owner of the water
wcThe class of water the tile has to be
random_bitsEventual random bits to be set for this tile

Definition at line 403 of file water_map.h.

References Tile::m2(), Tile::m3(), Tile::m4(), Tile::m5(), Tile::m6(), Tile::m7(), MP_WATER, SB(), SetDockingTile(), SetTileOwner(), SetTileType(), SetWaterClass(), SetWaterTileType(), and WATER_TILE_CLEAR.

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

◆ SetDockingTile()

void SetDockingTile ( Tile  t,
bool  b 
)
inline

Set the docking tile state of a tile.

This is used by pathfinders to reach their destination. As well as water tiles, half-rail tiles, buoys and aqueduct ends can also be docking tiles.

Parameters
tthe tile
bthe docking tile state

Definition at line 361 of file water_map.h.

References AssignBit(), IsTileType(), Tile::m1(), MP_RAILWAY, MP_STATION, MP_TUNNELBRIDGE, and MP_WATER.

Referenced by AfterLoadGame(), CheckForDockingTile(), ClearDockingTilesCheckingNeighbours(), CmdRemoveSingleRail(), MakeBridgeRamp(), MakeLockTile(), MakeRailDepot(), MakeShipDepot(), MakeShore(), MakeStation(), and MakeWater().

◆ SetNonFloodingWaterTile()

void SetNonFloodingWaterTile ( Tile  t,
bool  b 
)
inline

Set the non-flooding water tile state of a tile.

Parameters
tthe tile
bthe non-flooding water tile state

Definition at line 524 of file water_map.h.

References AssignBit(), IsTileType(), Tile::m3(), and MP_WATER.

Referenced by AfterLoadGame(), ClearNeighbourNonFloodingStates(), and TileLoop_Water().

◆ SetWaterClass()

void SetWaterClass ( Tile  t,
WaterClass  wc 
)
inline

Set the water class at a tile.

Parameters
tWater tile to change.
wcNew water class.
Precondition
IsTileType(t, MP_WATER) || IsTileType(t, MP_STATION) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_OBJECT)

Definition at line 124 of file water_map.h.

References HasTileWaterClass(), Tile::m1(), and SB().

Referenced by AfterLoadGame(), MakeIndustry(), MakeLockTile(), MakeObject(), MakeShipDepot(), MakeShore(), MakeStation(), MakeTree(), MakeWater(), SetTreeGroundDensity(), and SetWaterClassDependingOnSurroundings().

◆ SetWaterTileType()

void SetWaterTileType ( Tile  t,
WaterTileType  type 
)
inline

Set the water tile type of a tile.

Parameters
tWater tile to set.
typeWater tile type of the tile.

Definition at line 89 of file water_map.h.

References IsTileType(), Tile::m5(), MP_WATER, SB(), to_underlying(), WBL_TYPE_BEGIN, and WBL_TYPE_COUNT.

Referenced by AfterLoadGame(), MakeLockTile(), MakeShipDepot(), MakeShore(), and MakeWater().

Variable Documentation

◆ WBL_DEPOT_AXIS

constexpr uint8_t WBL_DEPOT_AXIS = 1
staticconstexpr

Depot axis flag.

Definition at line 28 of file water_map.h.

Referenced by GetShipDepotAxis(), and MakeShipDepot().

◆ WBL_DEPOT_PART

constexpr uint8_t WBL_DEPOT_PART = 0
staticconstexpr

Depot part flag.

Definition at line 27 of file water_map.h.

Referenced by GetShipDepotPart(), and MakeShipDepot().

◆ WBL_LOCK_ORIENT_BEGIN

constexpr uint8_t WBL_LOCK_ORIENT_BEGIN = 0
staticconstexpr

Start of lock orientation bitfield.

Definition at line 22 of file water_map.h.

Referenced by GetLockDirection(), and MakeLockTile().

◆ WBL_LOCK_ORIENT_COUNT

constexpr uint8_t WBL_LOCK_ORIENT_COUNT = 2
staticconstexpr

Length of lock orientation bitfield.

Definition at line 23 of file water_map.h.

Referenced by GetLockDirection().

◆ WBL_LOCK_PART_BEGIN

constexpr uint8_t WBL_LOCK_PART_BEGIN = 2
staticconstexpr

Start of lock part bitfield.

Definition at line 24 of file water_map.h.

Referenced by GetLockPart(), and MakeLockTile().

◆ WBL_LOCK_PART_COUNT

constexpr uint8_t WBL_LOCK_PART_COUNT = 2
staticconstexpr

Length of lock part bitfield.

Definition at line 25 of file water_map.h.

Referenced by GetLockPart().

◆ WBL_TYPE_BEGIN

constexpr uint8_t WBL_TYPE_BEGIN = 4
staticconstexpr

Bit field layout of m5 for water tiles.

Start of the 'type' bitfield.

Definition at line 19 of file water_map.h.

Referenced by GetWaterTileType(), and SetWaterTileType().

◆ WBL_TYPE_COUNT

constexpr uint8_t WBL_TYPE_COUNT = 4
staticconstexpr

Length of the 'type' bitfield.

Definition at line 20 of file water_map.h.

Referenced by GetWaterTileType(), and SetWaterTileType().