summaryrefslogtreecommitdiff
path: root/src/water_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-30 17:17:04 +0000
committerrubidium <rubidium@openttd.org>2007-08-30 17:17:04 +0000
commitf4482907dabf064299c7ef50a3ff47589ccb54ff (patch)
tree8562d4448fae5c239425c0e3a045ac05afd33329 /src/water_cmd.cpp
parentf8306999712ddfd98ee342962ff446ccadcd8d1a (diff)
downloadopenttd-f4482907dabf064299c7ef50a3ff47589ccb54ff.tar.xz
(svn r11005) -Codechange: move the tiletype specific terraforming checks to the functions for those tile types.
-Codechange: barren the rail grounds on terraforming.
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r--src/water_cmd.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 4c013857a..a3e97c734 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -802,6 +802,14 @@ static uint32 VehicleEnter_Water(Vehicle *v, TileIndex tile, int x, int y)
return VETSB_CONTINUE;
}
+static CommandCost TerraformTile_Water(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
+{
+ /* Canals can't be terraformed */
+ if (IsClearWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_MUST_DEMOLISH_CANAL_FIRST);
+
+ return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+}
+
extern const TileTypeProcs _tile_type_water_procs = {
DrawTile_Water, /* draw_tile_proc */
@@ -817,4 +825,5 @@ extern const TileTypeProcs _tile_type_water_procs = {
NULL, /* get_produced_cargo_proc */
VehicleEnter_Water, /* vehicle_enter_tile_proc */
GetFoundation_Water, /* get_foundation_proc */
+ TerraformTile_Water, /* terraform_tile_proc */
};