summaryrefslogtreecommitdiff
path: root/src/water.h
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2011-12-03 23:40:46 +0000
committermichi_cc <michi_cc@openttd.org>2011-12-03 23:40:46 +0000
commitd3b7b89493e025654d218fb77da095649b4f6ba2 (patch)
tree6667e4164c5c8bda4c1b7092376872b315c65610 /src/water.h
parentf98312eb77e12cfa45de40a1b4e8359160b0d9ff (diff)
downloadopenttd-d3b7b89493e025654d218fb77da095649b4f6ba2.tar.xz
(svn r23415) -Feature: Infrastructure maintenance costs.
Diffstat (limited to 'src/water.h')
-rw-r--r--src/water.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/water.h b/src/water.h
index 56bd92fde..bf26cf90d 100644
--- a/src/water.h
+++ b/src/water.h
@@ -16,6 +16,8 @@
#include "company_type.h"
#include "slope_type.h"
#include "water_map.h"
+#include "economy_func.h"
+#include "core/math_func.hpp"
/**
* Describes the behaviour of a tile during flooding.
@@ -43,4 +45,14 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o);
bool RiverModifyDesertZone(TileIndex tile, void *data);
+/**
+ * Calculates the maintenance cost of a number of canal tiles.
+ * @param num Number of canal tiles.
+ * @return Total cost.
+ */
+static inline Money CanalMaintenanceCost(uint32 num)
+{
+ return (_price[PR_INFRASTRUCTURE_WATER] * num * (1 + IntSqrt(num))) >> 6; // 6 bits scaling.
+}
+
#endif /* WATER_H */