(svn r13846) -Fix (r13838): Do not draw water borders inside of industries.
authorfrosch
Sun, 27 Jul 2008 09:16:23 +0000
changeset 9722 614d4514d37f
parent 9721 b6441d53c221
child 9723 db2564531299
(svn r13846) -Fix (r13838): Do not draw water borders inside of industries.
src/water_cmd.cpp
--- a/src/water_cmd.cpp	Sun Jul 27 09:12:18 2008 +0000
+++ b/src/water_cmd.cpp	Sun Jul 27 09:16:23 2008 +0000
@@ -536,11 +536,29 @@
 			return false;
 
 		case MP_STATION:
-			if (IsOilRig(tile)) return GetWaterClass(tile) != WATER_CLASS_INVALID;
+			if (IsOilRig(tile)) {
+				/* Do not draw waterborders inside of industries.
+				 * Note: There is no easy way to detect the industry of an oilrig tile. */
+				TileIndex src_tile = tile + TileOffsByDir(from);
+				if ((IsTileType(src_tile, MP_STATION) && IsOilRig(src_tile)) ||
+				    (IsTileType(src_tile, MP_INDUSTRY))) return true;
+
+				return GetWaterClass(tile) != WATER_CLASS_INVALID;
+			}
 			return (IsDock(tile) && GetTileSlope(tile, NULL) == SLOPE_FLAT) || IsBuoy(tile);
 
-		case MP_INDUSTRY: return IsIndustryTileOnWater(tile);
+		case MP_INDUSTRY: {
+			/* Do not draw waterborders inside of industries.
+			 * Note: There is no easy way to detect the industry of an oilrig tile. */
+			TileIndex src_tile = tile + TileOffsByDir(from);
+			if ((IsTileType(src_tile, MP_STATION) && IsOilRig(src_tile)) ||
+			    (IsTileType(src_tile, MP_INDUSTRY) && GetIndustryIndex(src_tile) == GetIndustryIndex(tile))) return true;
+
+			return IsIndustryTileOnWater(tile);
+		}
+
 		case MP_TUNNELBRIDGE: return GetTunnelBridgeTransportType(tile) == TRANSPORT_WATER && ReverseDiagDir(GetTunnelBridgeDirection(tile)) == DirToDiagDir(from);
+
 		default:          return false;
 	}
 }