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"
21 * Describes the behaviour of a tile during flooding.
23 enum FloodingBehaviour
{
24 FLOOD_NONE
, ///< The tile does not flood neighboured tiles.
25 FLOOD_ACTIVE
, ///< The tile floods neighboured tiles.
26 FLOOD_PASSIVE
, ///< The tile does not actively flood neighboured tiles, but it prevents them from drying up.
27 FLOOD_DRYUP
, ///< The tile drys up if it is not constantly flooded from neighboured tiles.
30 FloodingBehaviour
GetFloodingBehaviour(TileIndex tile
);
32 void TileLoop_Water(TileIndex tile
);
33 bool FloodHalftile(TileIndex t
);
34 void DoFloodTile(TileIndex target
);
36 void ConvertGroundTilesIntoWaterTiles();
38 void DrawShipDepotSprite (BlitArea
*dpi
, int x
, int y
, DiagDirection dir
);
39 void DrawWaterClassGround(const struct TileInfo
*ti
);
40 void DrawShoreTile (const struct TileInfo
*ti
);
42 void MakeWaterKeepingClass(TileIndex tile
, Owner o
);
44 void RiverModifyDesertZone (TileIndex tile
);
46 bool IsWateredTile(TileIndex tile
, Direction from
);
49 * Calculates the maintenance cost of a number of canal tiles.
50 * @param num Number of canal tiles.
53 static inline Money
CanalMaintenanceCost(uint32 num
)
55 return (_price
[PR_INFRASTRUCTURE_WATER
] * num
* (1 + IntSqrt(num
))) >> 6; // 6 bits scaling.