OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
10 #ifndef WATER_REGIONS_H
11 #define WATER_REGIONS_H
16 using TWaterRegionPatchLabel = uint8_t;
17 using TWaterRegionIndex = uint;
19 constexpr
int WATER_REGION_EDGE_LENGTH = 16;
20 constexpr
int WATER_REGION_NUMBER_OF_TILES = WATER_REGION_EDGE_LENGTH * WATER_REGION_EDGE_LENGTH;
21 constexpr TWaterRegionPatchLabel INVALID_WATER_REGION_PATCH = 0;
48 bool operator==(
const WaterRegionDesc &other)
const {
return x == other.
x &&
y == other.
y; }
49 bool operator!=(
const WaterRegionDesc &other)
const {
return !(*
this == other); }
68 void PrintWaterRegionDebugInfo(
TileIndex tile);
Describes a single interconnected patch of water within a particular water region.
int y
The Y coordinate of the water region, i.e. Y=2 is the 3rd water region along the Y-axis.
TileIndex GetWaterRegionCenterTile(const WaterRegionDesc &water_region)
Returns the center tile of a particular water region.
WaterRegionDesc GetWaterRegionInfo(TileIndex tile)
Returns basic water region information for the provided tile.
Describes a single square water region.
int y
The Y coordinate of the water region, i.e. Y=2 is the 3rd water region along the Y-axis.
WaterRegionPatchDesc GetWaterRegionPatchInfo(TileIndex tile)
Returns basic water region patch information for the provided tile.
void InvalidateWaterRegion(TileIndex tile)
Marks the water region that tile is part of as invalid.
TWaterRegionPatchLabel label
Unique label identifying the patch within the region.
int CalculateWaterRegionPatchHash(const WaterRegionPatchDesc &water_region_patch)
Calculates a number that uniquely identifies the provided water region patch.
int x
The X coordinate of the water region, i.e. X=2 is the 3rd water region along the X-axis.
void AllocateWaterRegions()
Allocates the appropriate amount of water regions for the current map size.
int x
The X coordinate of the water region, i.e. X=2 is the 3rd water region along the X-axis.
void VisitWaterRegionPatchNeighbors(const WaterRegionPatchDesc &water_region_patch, TVisitWaterRegionPatchCallBack &callback)
Calls the provided callback function on all accessible water region patches in each cardinal directio...
TWaterRegionIndex GetWaterRegionIndex(const WaterRegionDesc &water_region)
Returns the index of the water region.