diff options
author | rubidium <rubidium@openttd.org> | 2007-06-19 21:15:14 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-06-19 21:15:14 +0000 |
commit | 9e555736161a2daf6bab8407fc1d9ebd0b368eeb (patch) | |
tree | b67f71e2772005a10682936e5676aac930f4fe59 /src | |
parent | fe7f4a2f9cb7e7337ae0062a6d8aaa2c61daab5f (diff) | |
download | openttd-9e555736161a2daf6bab8407fc1d9ebd0b368eeb.tar.xz |
(svn r10230) -Fix [FS#594]: terraforming wipes out canals. Now you always have to remove the canal before terraforming, instead of "just" removing the canal.
Diffstat (limited to 'src')
-rw-r--r-- | src/clear_cmd.cpp | 8 | ||||
-rw-r--r-- | src/lang/english.txt | 1 | ||||
-rw-r--r-- | src/water_map.h | 5 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index c69ff0d99..7b95d085a 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -22,6 +22,7 @@ #include "unmovable_map.h" #include "genworld.h" #include "industry.h" +#include "water_map.h" struct TerraformerHeightMod { TileIndex tile; @@ -141,6 +142,13 @@ static int TerraformProc(TerraformerState *ts, TileIndex tile, int mode) } } + /* Canals can't be terraformed */ + if (IsClearWaterTile(tile) && IsCanal(tile)) { + _terraform_err_tile = tile; + _error_message = STR_MUST_DEMOLISH_CANAL_FIRST; + return -1; + } + ret = DoCommand(tile, 0, 0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR); if (CmdFailed(ret)) { diff --git a/src/lang/english.txt b/src/lang/english.txt index ba0de6a49..ea492f0a4 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1891,6 +1891,7 @@ STR_3804_WATER :Water STR_3805_COAST_OR_RIVERBANK :Coast or riverbank STR_3806_SHIP_DEPOT :Ship depot STR_3807_CAN_T_BUILD_ON_WATER :{WHITE}...Can't build on water +STR_MUST_DEMOLISH_CANAL_FIRST :{WHITE}Must demolish canal first ##id 0x4000 STR_4000_SAVE_GAME :{WHITE}Save Game diff --git a/src/water_map.h b/src/water_map.h index cb20bd15a..77fce0a17 100644 --- a/src/water_map.h +++ b/src/water_map.h @@ -45,6 +45,11 @@ static inline bool IsCoast(TileIndex t) return GetWaterTileType(t) == WATER_TILE_COAST; } +static inline bool IsCanal(TileIndex t) +{ + return GetWaterTileType(t) == WATER_TILE_CLEAR && GetTileOwner(t) != OWNER_WATER; +} + static inline bool IsClearWaterTile(TileIndex t) { return IsTileType(t, MP_WATER) && IsWater(t) && GetTileSlope(t, NULL) == SLOPE_FLAT; |