OpenTTD

water.h
Go to the documentation of this file.
1 /* $Id: water.h 25229 2013-05-06 20:48:18Z planetmaker $ */
2
3 /*
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/>.
8 */
9
12 #ifndef WATER_H
13 #define WATER_H
14
15 #include "water_map.h"
16 #include "economy_func.h"
17
21 enum FloodingBehaviour {
22 FLOOD_NONE,
23 FLOOD_ACTIVE,
24 FLOOD_PASSIVE,
25 FLOOD_DRYUP,
26 };
27
28 FloodingBehaviour GetFloodingBehaviour(TileIndex tile);
29
30 void TileLoop_Water(TileIndex tile);
31 bool FloodHalftile(TileIndex t);
32 void DoFloodTile(TileIndex target);
33
34 void ConvertGroundTilesIntoWaterTiles();
35
36 void DrawShipDepotSprite(int x, int y, Axis axis, DepotPart part);
37 void DrawWaterClassGround(const struct TileInfo *ti);
38 void DrawShoreTile(Slope tileh);
39
40 void MakeWaterKeepingClass(TileIndex tile, Owner o);
41
42 bool RiverModifyDesertZone(TileIndex tile, void *data);
43
44 bool IsWateredTile(TileIndex tile, Direction from);
45
51 static inline Money CanalMaintenanceCost(uint32 num)
52 {
53 return (_price[PR_INFRASTRUCTURE_WATER] * num * (1 + IntSqrt(num))) >> 6; // 6 bits scaling.
54 }
55
56 #endif /* WATER_H */
FLOOD_DRYUP
The tile drys up if it is not constantly flooded from neighboured tiles.
Definition: water.h:25
TileInfo
Tile information, used while rendering the tile.
Definition: tile_cmd.h:44
TileLoop_Water
void TileLoop_Water(TileIndex tile)
Let a water tile floods its diagonal adjoining tiles called from tunnelbridge_cmd, and by TileLoop_Industry() and TileLoop_Track()
Definition: water_cmd.cpp:1153
Direction
Direction
Defines the 8 directions on the map.
Definition: direction_type.h:26
FloodingBehaviour
FloodingBehaviour
Describes the behaviour of a tile during flooding.
Definition: water.h:21
FLOOD_NONE
The tile does not flood neighboured tiles.
Definition: water.h:22
IsWateredTile
bool IsWateredTile(TileIndex tile, Direction from)
return true if a tile is a water tile wrt.
Definition: water_cmd.cpp:548
RiverModifyDesertZone
bool RiverModifyDesertZone(TileIndex tile, void *data)
Callback to create non-desert around a river tile.
Definition: water_cmd.cpp:379
GetFloodingBehaviour
FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
Returns the behaviour of a tile during flooding.
Definition: water_cmd.cpp:1005
water_map.h
Map accessors for water tiles.
FLOOD_PASSIVE
The tile does not actively flood neighboured tiles, but it prevents them from drying up...
Definition: water.h:24
FloodHalftile
bool FloodHalftile(TileIndex t)
Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore...
Definition: rail_cmd.cpp:749
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
DepotPart
DepotPart
Sections of the water depot.
Definition: water_map.h:59
economy_func.h
Functions related to the economy.
FLOOD_ACTIVE
The tile floods neighboured tiles.
Definition: water.h:23
Slope
Slope
Enumeration for the slope-type.
Definition: slope_type.h:50
CanalMaintenanceCost
static Money CanalMaintenanceCost(uint32 num)
Calculates the maintenance cost of a number of canal tiles.
Definition: water.h:51
IntSqrt
uint32 IntSqrt(uint32 num)
Compute the integer square root.
Definition: math_func.cpp:79
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:20
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition: direction_type.h:127
OverflowSafeInt< int64, INT64_MAX, INT64_MIN >
DoFloodTile
void DoFloodTile(TileIndex target)
Floods a tile.
Definition: water_cmd.cpp:1041