diff options
author | truelight <truelight@openttd.org> | 2006-08-20 18:44:26 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-20 18:44:26 +0000 |
commit | 9e755051a1ca02029c4279e7588553a9d9dc54f2 (patch) | |
tree | 2a0ccade3f9243a1b1147f11b50ec61dca2e5c3d /clear_cmd.c | |
parent | e5fb66a23ff8a7ff64ccb8838f76bfaf7a284aff (diff) | |
download | openttd-9e755051a1ca02029c4279e7588553a9d9dc54f2.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.c | 12 |
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; } |