(svn r11952) -Fix (r11926): Prevent industries from being built on rivers, unless they require water.
authorpeter1138
Tue, 22 Jan 2008 22:17:28 +0000
changeset 8879 72f5aebfe209
parent 8878 5762124eec25
child 8880 6ae9ec825155
(svn r11952) -Fix (r11926): Prevent industries from being built on rivers, unless they require water.
src/industry_cmd.cpp
src/water_map.h
--- a/src/industry_cmd.cpp	Tue Jan 22 21:01:35 2008 +0000
+++ b/src/industry_cmd.cpp	Tue Jan 22 22:17:28 2008 +0000
@@ -1226,7 +1226,7 @@
 			IndustryBehaviour ind_behav = GetIndustrySpec(type)->behaviour;
 
 			/* Perform land/water check if not disabled */
-			if (!HasBit(its->slopes_refused, 5) && (IsWaterTile(cur_tile) == !(ind_behav & INDUSTRYBEH_BUILT_ONWATER))) return false;
+			if (!HasBit(its->slopes_refused, 5) && ((IsWaterTile(cur_tile) || IsRiverTile(cur_tile)) == !(ind_behav & INDUSTRYBEH_BUILT_ONWATER))) return false;
 
 			if (HasBit(its->callback_flags, CBM_INDT_SHAPE_CHECK)) {
 				custom_shape = true;
--- a/src/water_map.h	Tue Jan 22 21:01:35 2008 +0000
+++ b/src/water_map.h	Tue Jan 22 22:17:28 2008 +0000
@@ -72,6 +72,11 @@
 	return IsTileType(t, MP_WATER) && IsWater(t);
 }
 
+static inline bool IsRiverTile(TileIndex t)
+{
+	return IsTileType(t, MP_WATER) && IsRiver(t);
+}
+
 static inline TileIndex GetOtherShipDepotTile(TileIndex t)
 {
 	return t + (HasBit(_m[t].m5, 0) ? -1 : 1) * (HasBit(_m[t].m5, 1) ? TileDiffXY(0, 1) : TileDiffXY(1, 0));