--- C:/Users/Ricardo/AppData/Local/Temp/water_cmd.cpp-revBASE.svn001.tmp.cpp dom Set 21 12:24:51 2014
+++ C:/OpenTTD/trunk/src/water_cmd.cpp seg Fev 16 19:47:21 2015
@@ -258,10 +258,14 @@ static CommandCost DoBuildLock(TileIndex tile, Dia
/* middle tile */
WaterClass wc_middle = IsWaterTile(tile) ? GetWaterClass(tile) : WATER_CLASS_CANAL;
- ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
- if (ret.Failed()) return ret;
- cost.AddCost(ret);
+ if (!IsWaterTile(tile)) {
+ ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ if (ret.Failed()) return ret;
+ cost.AddCost(ret);
+ cost.AddCost(_price[PR_BUILD_CANAL]);
+ }
+
/* lower tile */
WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
@@ -298,6 +302,7 @@ static CommandCost DoBuildLock(TileIndex tile, Dia
if (c != NULL) {
/* Counts for the water. */
if (!IsWaterTile(tile - delta)) c->infrastructure.water++;
+ if (!IsWaterTile(tile)) c->infrastructure.water++;
if (!IsWaterTile(tile + delta)) c->infrastructure.water++;
/* Count for the lock itself. */
c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles.
@@ -348,6 +353,9 @@ static CommandCost RemoveLock(TileIndex tile, DoCo
if (GetWaterClass(tile) == WATER_CLASS_RIVER) {
MakeRiver(tile, Random());
} else {
+ if (c != NULL) {
+ c->infrastructure.water--;
+ }
DoClearSquare(tile);
}
MakeWaterKeepingClass(tile + delta, GetTileOwner(tile + delta));