|
OpenTTD Source 20260531-master-g0e951f3528
|
Functions related to water management. More...
Go to the source code of this file.
Enumerations | |
| enum class | FloodingBehaviour : uint8_t { None , Active , Passive , DryOut } |
| Describes the behaviour of a tile during flooding. More... | |
Functions | |
| FloodingBehaviour | GetFloodingBehaviour (TileIndex tile) |
| Returns the behaviour of a tile during flooding. | |
| void | ClearNeighbourNonFloodingStates (TileIndex tile) |
| Clear non-flooding state of the tiles around a tile. | |
| void | TileLoop_Water (TileIndex tile) |
| Tile callback function signature for running periodic tile updates. | |
| bool | FloodHalftile (TileIndex t) |
| Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore. | |
| void | ConvertGroundTilesIntoWaterTiles () |
| void | DrawShipDepotSprite (int x, int y, Axis axis, DepotPart part) |
| void | DrawWaterClassGround (const struct TileInfo *ti) |
| void | DrawShoreTile (Slope tileh) |
| void | MakeWaterKeepingClass (TileIndex tile, Owner o) |
| void | CheckForDockingTile (TileIndex t) |
| Mark the supplied tile as a docking tile if it is suitable for docking. | |
| void | MakeRiverAndModifyDesertZoneAround (TileIndex tile) |
| Make a river tile and remove desert directly around it. | |
| void | RiverMakeWider (TileIndex tile, TileIndex origin_tile) |
| Widen a river by expanding into adjacent tiles via circular tile search. | |
| bool | RiverFlowsDown (TileIndex begin, TileIndex end) |
| Check whether a river at begin could (logically) flow down to end. | |
| bool | IsWateredTile (TileIndex tile, Direction from) |
| return true if a tile is a water tile wrt. | |
| Money | CanalMaintenanceCost (uint32_t num) |
| Calculates the maintenance cost of a number of canal tiles. | |
Variables | |
| static const uint | RIVER_OFFSET_DESERT_DISTANCE = 5 |
| Circular tile search diameter to create non-desert around a river tile. | |
Functions related to water management.
Definition in file water.h.
|
strong |
Describes the behaviour of a tile during flooding.
|
inline |
Calculates the maintenance cost of a number of canal tiles.
| num | Number of canal tiles. |
Definition at line 53 of file water.h.
References _price, InfrastructureWater, and IntSqrt().
Referenced by CompaniesGenStatistics().
| void CheckForDockingTile | ( | TileIndex | t | ) |
Mark the supplied tile as a docking tile if it is suitable for docking.
Tiles surrounding the tile are tested to be docks with correct orientation.
| t | Tile to test. |
Definition at line 201 of file water_cmd.cpp.
References OrthogonalTileArea::Add(), Begin, Station::docking_station, End, BaseStation::GetByTile(), Industry::GetByTile(), Industry, IsDockTile(), IsDockWaterPart(), IsOilRig(), IsTileType(), IsValidTile(), Industry::neutral_station, SetDockingTile(), Station, and TileOffsByDiagDir().
Referenced by ClearDockingTilesCheckingNeighbours(), CmdBuildBridge(), CmdBuildBuoy(), CmdBuildCanal(), CmdBuildShipDepot(), CmdBuildSingleRail(), DoBuildLock(), and DoFloodTile().
| void ClearNeighbourNonFloodingStates | ( | TileIndex | tile | ) |
Clear non-flooding state of the tiles around a tile.
| tile | The centre of the tile where other tiles' non-flooding state is cleared. |
Definition at line 98 of file water_cmd.cpp.
References Begin, End, IsTileType(), IsValidTile(), SetNonFloodingWaterTile(), TileOffsByDir(), and Water.
Referenced by BuildObject(), ClearTile_Water(), CmdBuildBuoy(), CmdLandscapeClear(), PlantTreesOnTile(), and RemoveLock().
| void ConvertGroundTilesIntoWaterTiles | ( | ) |
Definition at line 1347 of file water_cmd.cpp.
Definition at line 1007 of file water_cmd.cpp.
| void DrawShoreTile | ( | Slope | tileh | ) |
Definition at line 950 of file water_cmd.cpp.
| bool FloodHalftile | ( | TileIndex | t | ) |
Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore.
The function floods the lower halftile, if the tile has a halftile foundation.
| t | The tile to flood. |
Definition at line 761 of file rail_cmd.cpp.
References _current_company, ApplyFoundationToSlope(), CornerToTrackBits(), Execute, FindFirstTrack(), GetHighestSlopeCorner(), GetRailFoundation(), GetRailGroundType(), GetTileSlope(), GetTrackBits(), HalfTileWater, IsNonContinuousFoundation(), IsPlainRailTile(), IsSlopeWithOneCornerRaised(), IsSlopeWithThreeCornersRaised(), IsSteepSlope(), MakeShore(), MarkTileDirtyByTile(), OppositeCorner(), OWNER_WATER, SetRailGroundType(), and TRACK_BIT_NONE.
Referenced by DoFloodTile().
| FloodingBehaviour GetFloodingBehaviour | ( | TileIndex | tile | ) |
Returns the behaviour of a tile during flooding.
| tile | The tile to get the behaviour for. |
Definition at line 1140 of file water_cmd.cpp.
References Active, DryOut, GetRailGroundType(), GetTileSlope(), GetTileType(), GetTreeGround(), GetWaterClass(), HalfTileWater, Industry, IsCoast(), IsSlopeWithOneCornerRaised(), None, Object, Railway, Sea, Shore, Station, Trees, Void, and Water.
Referenced by CheckRailSlope(), and TileLoop_Water().
return true if a tile is a water tile wrt.
a certain direction.
| tile | The tile of interest. |
| from | The direction of interest. |
Definition at line 675 of file water_cmd.cpp.
References Clear, Coast, Depot, DiagDirToAxis(), DirToDiagDir(), E, GetIndustryIndex(), GetLockDirection(), GetRailGroundType(), GetTileSlope(), GetTileType(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), GetWaterTileType(), HalfTileWater, Industry, IsBuoy(), IsDock(), IsOilRig(), IsPlainRail(), IsTileFlat(), IsTileOnWater(), IsTileType(), Lock, N, NE, NW, Object, Railway, ReverseDiagDir(), S, SE, SLOPE_E, SLOPE_N, SLOPE_S, SLOPE_W, Station, SW, TileOffsByDir(), TRANSPORT_WATER, TunnelBridge, Void, W, and Water.
Referenced by DrawWaterEdges(), and CanalScopeResolver::GetVariable().
| void MakeRiverAndModifyDesertZoneAround | ( | TileIndex | tile | ) |
Make a river tile and remove desert directly around it.
| tile | The tile to change into river and create non-desert around |
Definition at line 479 of file water_cmd.cpp.
References Desert, GetTropicZone(), MakeRiver(), MarkTileDirtyByTile(), Normal, RIVER_OFFSET_DESERT_DISTANCE, and SetTropicZone().
Referenced by MakeLake(), MakeWetlands(), and RiverMakeWider().
| void MakeWaterKeepingClass | ( | TileIndex | tile, |
| Owner | o ) |
Definition at line 225 of file water_cmd.cpp.
Check whether a river at begin could (logically) flow down to end.
| begin | The origin of the flow. |
| end | The destination of the flow. |
Definition at line 1322 of file landscape.cpp.
References DistanceManhattan(), GetTileSlopeZ(), IsInclinedSlope(), and SLOPE_FLAT.
Referenced by FlowRiver(), and YapfRiverBuilder::PfFollowNode().
Widen a river by expanding into adjacent tiles via circular tile search.
| tile | The tile to try expanding the river into. |
| origin_tile | The tile to try surrounding the river around. |
Definition at line 1181 of file landscape.cpp.
References Auto, Begin, ChangeDiagDir(), ComplementSlope(), End, Execute, GetInclinedSlopeDirection(), GetTileMaxZ(), GetTileSlope(), GetTileZ(), IsInclinedSlope(), IsRiver(), IsSlopeWithOneCornerRaised(), IsSlopeWithThreeCornersRaised(), IsSteepSlope(), IsTileFlat(), IsValidTile(), IsWaterTile(), Left90, MakeRiverAndModifyDesertZoneAround(), ReverseDiagDir(), Right90, SLOPE_FLAT, and TileAddByDiagDir().
| void TileLoop_Water | ( | TileIndex | tile | ) |
Tile callback function signature for running periodic tile updates.
| tile | The tile to update. |
Let a water tile floods its diagonal adjoining tiles called by TileLoop_Industry, TileLoop_Rail, TileLoop_Station, TileLoop_Object, TileLoop_Trees and TileLoop_Void.
Definition at line 1292 of file water_cmd.cpp.
References _flood_from_dirs, Active, AddTileIndexDiffCWrap(), AmbientSoundEffect(), Begin, DoDryUp(), DoFloodTile(), DryOut, End, GetFloodingBehaviour(), GetFoundationSlope(), GetTreeGround(), INVALID_TILE, IsBuoy(), IsDock(), IsNonFloodingWaterTile(), IsTileType(), IsValidTile(), Passive, ReverseDir(), SetNonFloodingWaterTile(), Shore, SLOPE_HALFTILE_MASK, SLOPE_STEEP, Station, TileIndexDiffCByDir(), Trees, and Water.
Referenced by TileLoop_Industry(), TileLoop_Object(), TileLoop_Rail(), TileLoop_Station(), TileLoop_Trees(), and TileLoop_Void().
|
static |
Circular tile search diameter to create non-desert around a river tile.
Definition at line 44 of file water.h.
Referenced by CmdBuildCanal(), and MakeRiverAndModifyDesertZoneAround().