Fix: CmdSetAutoReplace didn't validate group type and engine type match (#9950)
[openttd-github.git] / src / water.h
blob27c3339c1852e990dc0d2f5e925dde71a67469b3
1 /*
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/>.
6 */
8 /** @file water.h Functions related to water (management) */
10 #ifndef WATER_H
11 #define WATER_H
13 #include "water_map.h"
14 #include "economy_func.h"
16 /**
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);
28 void TileLoop_Water(TileIndex tile);
29 bool FloodHalftile(TileIndex t);
30 void DoFloodTile(TileIndex target);
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 bool RiverModifyDesertZone(TileIndex tile, void *data);
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);
46 /**
47 * Calculates the maintenance cost of a number of canal tiles.
48 * @param num Number of canal tiles.
49 * @return Total cost.
51 static inline Money CanalMaintenanceCost(uint32 num)
53 return (_price[PR_INFRASTRUCTURE_WATER] * num * (1 + IntSqrt(num))) >> 6; // 6 bits scaling.
56 #endif /* WATER_H */