summaryrefslogtreecommitdiff
path: root/src/water_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-07-27 09:16:23 +0000
committerfrosch <frosch@openttd.org>2008-07-27 09:16:23 +0000
commit2cec059248b7f81d352c9e07e65fe1414fdc026d (patch)
tree2eb60b2090a9de5ad313427a37fb1f7c93b5333e /src/water_cmd.cpp
parent74c63ac9e2ef72b8c73f355d08a66ce0052e4861 (diff)
downloadopenttd-2cec059248b7f81d352c9e07e65fe1414fdc026d.tar.xz
(svn r13846) -Fix (r13838): Do not draw water borders inside of industries.
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r--src/water_cmd.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index db6872178..f409c250e 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -536,11 +536,29 @@ static bool IsWateredTile(TileIndex tile, Direction from)
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;
}
}