summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-04-26 10:50:36 +0000
committerfrosch <frosch@openttd.org>2015-04-26 10:50:36 +0000
commit7e12a1a9853d8467e48b14da7234c47e9456d69f (patch)
tree50e919772b1ab85f133fd6ff62a207f5d6e2d0e2 /src
parente3c8e8e8e8b666ad2a41ff59d9af5e8c64c204e6 (diff)
downloadopenttd-7e12a1a9853d8467e48b14da7234c47e9456d69f.tar.xz
(svn r27254) -Fix [FS#6264]: When building a lock on DC_AUTO-removable water-based objects, the water class was always set to canal.
Diffstat (limited to 'src')
-rw-r--r--src/water_cmd.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 7b74363be..4392eb210 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -263,8 +263,6 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
cost.AddCost(ret);
/* lower tile */
- WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
-
if (!IsWaterTile(tile - delta)) {
ret = DoCommand(tile - delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (ret.Failed()) return ret;
@@ -274,10 +272,9 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
if (!IsTileFlat(tile - delta)) {
return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
}
+ WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
/* upper tile */
- WaterClass wc_upper = IsWaterTile(tile + delta) ? GetWaterClass(tile + delta) : WATER_CLASS_CANAL;
-
if (!IsWaterTile(tile + delta)) {
ret = DoCommand(tile + delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (ret.Failed()) return ret;
@@ -287,6 +284,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag
if (!IsTileFlat(tile + delta)) {
return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
}
+ WaterClass wc_upper = IsWaterTile(tile + delta) ? GetWaterClass(tile + delta) : WATER_CLASS_CANAL;
if (IsBridgeAbove(tile) || IsBridgeAbove(tile - delta) || IsBridgeAbove(tile + delta)) {
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);