summaryrefslogtreecommitdiff
path: root/src/water.h
diff options
context:
space:
mode:
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 */