2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file water.h Functions related to water (management) */
13 #include "water_map.h"
14 #include "economy_func.h"
17 * Describes the behaviour of a tile during flooding.
19 enum FloodingBehaviour
{
20 FLOOD_NONE
, ///< The tile does not flood neighboured tiles.
21 FLOOD_ACTIVE
, ///< The tile floods neighboured tiles.
22 FLOOD_PASSIVE
, ///< The tile does not actively flood neighboured tiles, but it prevents them from drying up.
23 FLOOD_DRYUP
, ///< The tile drys up if it is not constantly flooded from neighboured tiles.
26 FloodingBehaviour
GetFloodingBehaviour(TileIndex tile
);
27 void ClearNeighbourNonFloodingStates(TileIndex tile
);
29 void TileLoop_Water(TileIndex tile
);
30 bool FloodHalftile(TileIndex t
);
32 void ConvertGroundTilesIntoWaterTiles();
34 void DrawShipDepotSprite(int x
, int y
, Axis axis
, DepotPart part
);
35 void DrawWaterClassGround(const struct TileInfo
*ti
);
36 void DrawShoreTile(Slope tileh
);
38 void MakeWaterKeepingClass(TileIndex tile
, Owner o
);
39 void CheckForDockingTile(TileIndex t
);
41 void MakeRiverAndModifyDesertZoneAround(TileIndex tile
);
42 static const uint RIVER_OFFSET_DESERT_DISTANCE
= 5; ///< Circular tile search radius to create non-desert around a river tile.
44 bool IsWateredTile(TileIndex tile
, Direction from
);
47 * Calculates the maintenance cost of a number of canal tiles.
48 * @param num Number of canal tiles.
51 inline Money
CanalMaintenanceCost(uint32_t num
)
53 return (_price
[PR_INFRASTRUCTURE_WATER
] * num
* (1 + IntSqrt(num
))) >> 6; // 6 bits scaling.