summaryrefslogtreecommitdiff
path: root/clear_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-20 18:44:26 +0000
committertruelight <truelight@openttd.org>2006-08-20 18:44:26 +0000
commit0c760998b37e60016e91a8822d1bdcb28827b37b (patch)
tree2a0ccade3f9243a1b1147f11b50ec61dca2e5c3d /clear_cmd.c
parent5a8687ccc00e574fcd63e8fdd2a56eb337fcd724 (diff)
downloadopenttd-0c760998b37e60016e91a8822d1bdcb28827b37b.tar.xz
(svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
To make this to work, in older games farmland is removed on load, and replanted
Diffstat (limited to 'clear_cmd.c')
-rw-r--r--clear_cmd.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/clear_cmd.c b/clear_cmd.c
index eab094d5d..df7763a7e 100644
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -16,6 +16,7 @@
#include "table/sprites.h"
#include "unmovable_map.h"
#include "genworld.h"
+#include "industry.h"
typedef struct TerraformerHeightMod {
TileIndex tile;
@@ -679,9 +680,14 @@ static void TileLoop_Clear(TileIndex tile)
SetClearCounter(tile, 0);
}
- field_type = GetFieldType(tile);
- field_type = (field_type < 8) ? field_type + 1 : 0;
- SetFieldType(tile, field_type);
+ if (GetIndustryIndexOfField(tile) == INVALID_INDUSTRY) {
+ /* This farmfield is no longer farmfield, so make it grass again */
+ MakeClear(tile, CLEAR_GRASS, 0);
+ } else {
+ field_type = GetFieldType(tile);
+ field_type = (field_type < 8) ? field_type + 1 : 0;
+ SetFieldType(tile, field_type);
+ }
break;
}