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

Variables

static constexpr uint8_t WBL_TYPE_BEGIN = 4
 Bit field layout of m5 for water tiles. More...
 
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 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 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 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 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 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 CmdBuildShipDepot(), CmdLandscapeClear(), DoBuildLock(), 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 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 CheckIfIndustryTilesAreFree(), CmdLandscapeClear(), 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 CanFollowRoad(), CmdBuildBuoy(), CmdBuildShipDepot(), DoBuildLock(), and GetClosestWaterDistance().

◆ 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 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(), 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 IsShipDestinationTile(), and CYapfCostShipT< Types >::PfCalcCost().

◆ 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 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().

◆ 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 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 GetDepotIndex(), GetShipDepotAxis(), GetShipDepotPart(), and IsDepotTile().

◆ 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(), and HasTileWaterGround().

◆ 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 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 CheckIfIndustryTilesAreFree(), CmdLandscapeClear(), DoBuildLock(), FindSpring(), FlowRiver(), GrowTownWithBridge(), 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.

◆ 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().

◆ 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 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 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.

◆ 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 DoFloodTile().

◆ 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 CheckForDockingTile(), 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 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 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 MakeLockTile(), MakeShipDepot(), MakeShore(), and MakeWater().

Variable Documentation

◆ 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().