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 "direction_type.h"
16 #include "map/water.h"
17 #include "economy_func.h"
20 * Describes the behaviour of a tile during flooding.
22 enum FloodingBehaviour
{
23 FLOOD_NONE
, ///< The tile does not flood neighboured tiles.
24 FLOOD_ACTIVE
, ///< The tile floods neighboured tiles.
25 FLOOD_PASSIVE
, ///< The tile does not actively flood neighboured tiles, but it prevents them from drying up.
26 FLOOD_DRYUP
, ///< The tile drys up if it is not constantly flooded from neighboured tiles.
29 FloodingBehaviour
GetFloodingBehaviour(TileIndex tile
);
31 void TileLoop_Water(TileIndex tile
);
32 bool FloodHalftile(TileIndex t
);
33 void DoFloodTile(TileIndex target
);
35 void ConvertGroundTilesIntoWaterTiles();
37 void DrawShipDepotSprite(int x
, int y
, DiagDirection dir
);
38 void DrawWaterClassGround(const struct TileInfo
*ti
);
39 void DrawShoreTile(Slope tileh
);
41 void MakeWaterKeepingClass(TileIndex tile
, Owner o
);
43 bool RiverModifyDesertZone(TileIndex tile
, void *data
);
45 bool IsWateredTile(TileIndex tile
, Direction from
);
48 * Calculates the maintenance cost of a number of canal tiles.
49 * @param num Number of canal tiles.
52 static inline Money
CanalMaintenanceCost(uint32 num
)
54 return (_price
[PR_INFRASTRUCTURE_WATER
] * num
* (1 + IntSqrt(num
))) >> 6; // 6 bits scaling.