4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file water.h Functions related to water (management) */
15 #include "water_map.h"
16 #include "economy_func.h"
19 * Describes the behaviour of a tile during flooding.
21 enum FloodingBehaviour
{
22 FLOOD_NONE
, ///< The tile does not flood neighboured tiles.
23 FLOOD_ACTIVE
, ///< The tile floods neighboured tiles.
24 FLOOD_PASSIVE
, ///< The tile does not actively flood neighboured tiles, but it prevents them from drying up.
25 FLOOD_DRYUP
, ///< The tile drys up if it is not constantly flooded from neighboured tiles.
28 FloodingBehaviour
GetFloodingBehaviour(TileIndex tile
);
30 void TileLoop_Water(TileIndex tile
);
31 bool FloodHalftile(TileIndex t
);
32 void DoFloodTile(TileIndex target
);
34 void ConvertGroundTilesIntoWaterTiles();
36 void DrawShipDepotSprite(int x
, int y
, Axis axis
, DepotPart part
);
37 void DrawWaterClassGround(const struct TileInfo
*ti
);
38 void DrawShoreTile(Slope tileh
);
40 void MakeWaterKeepingClass(TileIndex tile
, Owner o
);
42 bool RiverModifyDesertZone(TileIndex tile
, void *data
);
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 static inline Money
CanalMaintenanceCost(uint32 num
)
53 return (_price
[PR_INFRASTRUCTURE_WATER
] * num
* (1 + IntSqrt(num
))) >> 6; // 6 bits scaling.