(svn r4007) Add a function to make a farm field tile
authortron
Wed, 22 Mar 2006 08:48:50 +0000
changeset 3291 e0b2c01649f7
parent 3290 1a02d5e9205c
child 3292 368838183c08
(svn r4007) Add a function to make a farm field tile
clear_map.h
industry_cmd.c
--- a/clear_map.h	Tue Mar 21 23:22:21 2006 +0000
+++ b/clear_map.h	Wed Mar 22 08:48:50 2006 +0000
@@ -52,7 +52,18 @@
 	_m[t].m2 = 0;
 	_m[t].m3 = 0;
 	_m[t].m4 = 0 << 5 | 0 << 2;
-	_m[t].m5 = 0 << 5 | g << 2 | density;
+	SetClearGroundDensity(t, g, density);
+}
+
+
+static inline void MakeField(TileIndex t, uint field_type)
+{
+	SetTileType(t, MP_CLEAR);
+	SetTileOwner(t, OWNER_NONE);
+	_m[t].m2 = 0;
+	_m[t].m3 = field_type;
+	_m[t].m4 = 0 << 5 | 0 << 2;
+	SetClearGroundDensity(t, CL_FIELDS, 3);
 }
 
 #endif
--- a/industry_cmd.c	Tue Mar 21 23:22:21 2006 +0000
+++ b/industry_cmd.c	Wed Mar 22 08:48:50 2006 +0000
@@ -968,12 +968,7 @@
 	BEGIN_TILE_LOOP(cur_tile, size_x, size_y, tile)
 		cur_tile = TILE_MASK(cur_tile);
 		if (!IsBadFarmFieldTile2(cur_tile)) {
-			SetTileType(cur_tile, MP_CLEAR);
-			SetTileOwner(cur_tile, OWNER_NONE);
-			SetFieldType(cur_tile, field_type);
-			SetFenceSW(cur_tile, 0);
-			SetFenceSE(cur_tile, 0);
-			SetClearGroundDensity(cur_tile, CL_FIELDS, 3);
+			MakeField(cur_tile, field_type);
 			SetClearCounter(cur_tile, counter);
 			MarkTileDirtyByTile(cur_tile);
 		}