(svn r6739) -Fix (r6001): Crash on removing farmland belonging to a farm. The search would loop
authorDarkvater
Wed, 11 Oct 2006 21:20:53 +0000
changeset 4815 d702c4027451
parent 4814 8e8f3b110279
child 4816 e555e273cf08
(svn r6739) -Fix (r6001): Crash on removing farmland belonging to a farm. The search would loop
around the edges causing some troubles. Also make sure that the land after
farm removal is not barren but 2/3rd grass. Better suited.
clear_cmd.c
industry_cmd.c
--- a/clear_cmd.c	Wed Oct 11 18:57:02 2006 +0000
+++ b/clear_cmd.c	Wed Oct 11 21:20:53 2006 +0000
@@ -682,7 +682,7 @@
 
 			if (GetIndustryIndexOfField(tile) == INVALID_INDUSTRY && GetFieldType(tile) >= 7) {
 				/* This farmfield is no longer farmfield, so make it grass again */
-				MakeClear(tile, CLEAR_GRASS, 0);
+				MakeClear(tile, CLEAR_GRASS, 2);
 			} else {
 				field_type = GetFieldType(tile);
 				field_type = (field_type < 8) ? field_type + 1 : 0;
--- a/industry_cmd.c	Wed Oct 11 18:57:02 2006 +0000
+++ b/industry_cmd.c	Wed Oct 11 21:20:53 2006 +0000
@@ -147,6 +147,7 @@
 	if (i->type == IT_FARM || i->type == IT_FARM_2) {
 		/* Remove the farmland and convert it to regular tiles over time. */
 		BEGIN_TILE_LOOP(tile_cur, 42, 42, i->xy - TileDiffXY(21, 21)) {
+			tile_cur = TILE_MASK(tile_cur);
 			if (IsTileType(tile_cur, MP_CLEAR) && IsClearGround(tile_cur, CLEAR_FIELDS) &&
 					GetIndustryIndexOfField(tile_cur) == i->index) {
 				SetIndustryIndexOfField(tile_cur, INVALID_INDUSTRY);