summaryrefslogtreecommitdiff
path: root/src/clear_cmd.cpp
diff options
context:
space:
mode:
authorYexo <Yexo@openttd.org>2009-01-21 02:31:55 +0000
committerYexo <Yexo@openttd.org>2009-01-21 02:31:55 +0000
commite3c69b7c4ebebba0aa85ef41ff6627705acb1db5 (patch)
tree272533ac91b7bc3ab16c3ee1a997e142f3170a2a /src/clear_cmd.cpp
parent470437df70d63b2c44ce34d408b6820cfa446aed (diff)
downloadopenttd-e3c69b7c4ebebba0aa85ef41ff6627705acb1db5.tar.xz
(svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Diffstat (limited to 'src/clear_cmd.cpp')
-rw-r--r--src/clear_cmd.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index 8e55ce4c0..81d45bbaa 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -18,6 +18,7 @@
#include "economy_func.h"
#include "viewport_func.h"
#include "settings_type.h"
+#include "water.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -216,6 +217,16 @@ static void TileLoopClearDesert(TileIndex tile)
static void TileLoop_Clear(TileIndex tile)
{
+ /* If the tile is at any edge flood it to prevent maps without water. */
+ if (_settings_game.construction.freeform_edges && DistanceFromEdge(tile) == 1) {
+ uint z;
+ Slope slope = GetTileSlope(tile, &z);
+ if (z == 0 && slope == SLOPE_FLAT) {
+ DoFloodTile(tile);
+ MarkTileDirtyByTile(tile);
+ return;
+ }
+ }
TileLoopClearHelper(tile);
switch (_settings_game.game_creation.landscape) {