summaryrefslogtreecommitdiff
path: root/openttd.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
commit9e755051a1ca02029c4279e7588553a9d9dc54f2 (patch)
tree2a0ccade3f9243a1b1147f11b50ec61dca2e5c3d /openttd.c
parente5fb66a23ff8a7ff64ccb8838f76bfaf7a284aff (diff)
downloadopenttd-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 'openttd.c')
-rw-r--r--openttd.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/openttd.c b/openttd.c
index 4a71a589d..959890b00 100644
--- a/openttd.c
+++ b/openttd.c
@@ -50,6 +50,7 @@
#include "settings.h"
#include "genworld.h"
#include "date.h"
+#include "clear_map.h"
#include <stdarg.h>
@@ -1463,5 +1464,27 @@ bool AfterLoadGame(void)
}
}
+ /* From 32 on we save the industry who made the farmland.
+ * To give this prettyness to old savegames, we remove all farmfields and
+ * plant new ones. */
+ if (CheckSavegameVersion(32)) {
+ Industry *i;
+
+ BEGIN_TILE_LOOP(tile_cur, MapSizeX(), MapSizeY(), 0) {
+ if (IsTileType(tile_cur, MP_CLEAR) && IsClearGround(tile_cur, CLEAR_FIELDS)) {
+ MakeClear(tile_cur, CLEAR_GRASS, 3);
+ }
+ } END_TILE_LOOP(tile_cur, MapSizeX(), MapSizeY(), 0)
+
+ FOR_ALL_INDUSTRIES(i) {
+ uint j;
+
+ if (i->xy == 0) continue;
+ if (i->type == IT_FARM || i->type == IT_FARM_2) {
+ for (j = 0; j != 50; j++) PlantRandomFarmField(i);
+ }
+ }
+ }
+
return true;
}