|
OpenTTD Source 20251116-master-g21329071df
|
Handles dividing the water in the map into regions to assist pathfinding. More...
Go to the source code of this file.
Data Structures | |
| struct | WaterRegionPatchDesc |
| Describes a single interconnected patch of water within a particular water region. More... | |
| struct | WaterRegionDesc |
| Describes a single square water region. More... | |
Typedefs | |
| using | WaterRegionIndex = StrongType::Typedef< uint, struct TWaterRegionIndexTag, StrongType::Compare > |
| using | WaterRegionPatchLabel = StrongType::Typedef< uint8_t, struct TWaterRegionPatchLabelTag, StrongType::Compare, StrongType::Integer > |
| using | VisitWaterRegionPatchCallback = std::function< void(const WaterRegionPatchDesc &)> |
Functions | |
| int | CalculateWaterRegionPatchHash (const WaterRegionPatchDesc &water_region_patch) |
| Calculates a number that uniquely identifies the provided water region patch. | |
| 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. | |
| 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. | |
| void | VisitWaterRegionPatchNeighbours (const WaterRegionPatchDesc &water_region_patch, VisitWaterRegionPatchCallback &callback) |
| Calls the provided callback function on all accessible water region patches in each cardinal direction, plus any others that are reachable via aqueducts. | |
| void | AllocateWaterRegions () |
| Allocates the appropriate amount of water regions for the current map size. | |
| void | PrintWaterRegionDebugInfo (TileIndex tile) |
Variables | |
| constexpr int | WATER_REGION_EDGE_LENGTH = 16 |
| constexpr int | WATER_REGION_NUMBER_OF_TILES = WATER_REGION_EDGE_LENGTH * WATER_REGION_EDGE_LENGTH |
| constexpr WaterRegionPatchLabel | INVALID_WATER_REGION_PATCH {0} |
Handles dividing the water in the map into regions to assist pathfinding.
Definition in file water_regions.h.
| using VisitWaterRegionPatchCallback = std::function<void(const WaterRegionPatchDesc &)> |
Definition at line 58 of file water_regions.h.
| using WaterRegionIndex = StrongType::Typedef<uint, struct TWaterRegionIndexTag, StrongType::Compare> |
Definition at line 17 of file water_regions.h.
| using WaterRegionPatchLabel = StrongType::Typedef<uint8_t, struct TWaterRegionPatchLabelTag, StrongType::Compare, StrongType::Integer> |
Definition at line 18 of file water_regions.h.
| void AllocateWaterRegions | ( | ) |
Allocates the appropriate amount of water regions for the current map size.
Definition at line 414 of file water_regions.cpp.
References Debug.
Referenced by Map::Allocate().
| int CalculateWaterRegionPatchHash | ( | const WaterRegionPatchDesc & | water_region_patch | ) |
Calculates a number that uniquely identifies the provided water region patch.
| water_region_patch | The Water region to calculate the hash for. |
Definition at line 275 of file water_regions.cpp.
References WaterRegionPatchDesc::label.
| TileIndex GetWaterRegionCenterTile | ( | const WaterRegionDesc & | water_region | ) |
Returns the center tile of a particular water region.
| water_region | The water region to find the center tile for. |
Definition at line 285 of file water_regions.cpp.
References TileXY(), WaterRegionDesc::x, and WaterRegionDesc::y.
| WaterRegionDesc GetWaterRegionInfo | ( | TileIndex | tile | ) |
Returns basic water region information for the provided tile.
| tile | The tile for which the information will be calculated. |
Definition at line 294 of file water_regions.cpp.
Referenced by CYapfFollowShipT< Types >::PfFollowNode().
| WaterRegionPatchDesc GetWaterRegionPatchInfo | ( | TileIndex | tile | ) |
Returns basic water region patch information for the provided tile.
| tile | The tile for which the information will be calculated. |
Definition at line 303 of file water_regions.cpp.
References WaterRegion::GetLabel().
Referenced by VisitWaterRegionPatchNeighbours().
| void InvalidateWaterRegion | ( | TileIndex | tile | ) |
Marks the water region that tile is part of as invalid.
| tile | Tile within the water region that we wish to invalidate. |
Definition at line 313 of file water_regions.cpp.
References AddTileIndexDiffCWrap(), Debug, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_TILE, IsValidTile(), and TileIndexDiffCByDiagDir().
Referenced by BuildObject(), DoBuildLock(), and DoFloodTile().
| void PrintWaterRegionDebugInfo | ( | TileIndex | tile | ) |
Definition at line 428 of file water_regions.cpp.
| void VisitWaterRegionPatchNeighbours | ( | const WaterRegionPatchDesc & | water_region_patch, |
| VisitWaterRegionPatchCallback & | callback | ||
| ) |
Calls the provided callback function on all accessible water region patches in each cardinal direction, plus any others that are reachable via aqueducts.
| water_region_patch | Water patch within the water region to start searching from |
| callback | The function that will be called for each accessible water patch that is found |
Definition at line 391 of file water_regions.cpp.
References DIAGDIR_BEGIN, DIAGDIR_END, GetOtherBridgeEnd(), GetWaterRegionPatchInfo(), WaterRegion::HasCrossRegionAqueducts(), WaterRegionPatchDesc::label, VisitAdjacentWaterRegionPatchNeighbours(), WaterRegionPatchDesc::x, and WaterRegionPatchDesc::y.
|
constexpr |
Definition at line 22 of file water_regions.h.
|
constexpr |
Definition at line 20 of file water_regions.h.
|
constexpr |
Definition at line 21 of file water_regions.h.