summaryrefslogtreecommitdiff
path: root/clear_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-22 22:30:35 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-22 22:30:35 +0000
commit48855806d63e8d7e6496a3f023c7c4ac85826922 (patch)
tree774b503fcce4d3f005ea0e7b6c4905daf2b7c1b1 /clear_cmd.c
parent898bb915ac6ac2be3d2ea112e536f7ea602baec4 (diff)
downloadopenttd-48855806d63e8d7e6496a3f023c7c4ac85826922.tar.xz
(svn r3228) - Fix: [ 1327011 ] Fix: don't lower land on tunnel, even with diag tracks on it (based on patch by glx)
Diffstat (limited to 'clear_cmd.c')
-rw-r--r--clear_cmd.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/clear_cmd.c b/clear_cmd.c
index c79ac608d..23168d945 100644
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -86,7 +86,7 @@ static void TerraformAddDirtyTileAround(TerraformerState *ts, TileIndex tile)
static int TerraformProc(TerraformerState *ts, TileIndex tile, int mode)
{
int r;
- int32 ret;
+ bool skip_clear = false;
assert(tile < MapSize());
@@ -111,17 +111,19 @@ static int TerraformProc(TerraformerState *ts, TileIndex tile, int mode)
// If we have a single diagonal track there, the other side of
// tile can be terraformed.
- if ((_m[tile].m5 & ~0x40) == _railway_modes[mode]) return 0;
+ if ((_m[tile].m5 & ~0x40) == _railway_modes[mode]) skip_clear = true;
}
- ret = DoCommandByTile(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ if (!skip_clear) {
+ int32 ret = DoCommandByTile(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
- if (ret == CMD_ERROR) {
- _terraform_err_tile = tile;
- return -1;
- }
+ if (CmdFailed(ret)) {
+ _terraform_err_tile = tile;
+ return -1;
+ }
- ts->cost += ret;
+ ts->cost += ret;
+ }
if (ts->tile_table_count >= 625) return -1;
ts->tile_table[ts->tile_table_count++] = tile;