summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-22 08:48:50 +0000
committertron <tron@openttd.org>2006-03-22 08:48:50 +0000
commit1184811bc029b8f25d3f46ef9bb65b9f71b94f21 (patch)
treeb0c8be05e2dd14ba1d565d5c647cd7ec4e38dfb9
parentfc6874a52e92cbb2290ff6437f52a9bbe9e4ed66 (diff)
downloadopenttd-1184811bc029b8f25d3f46ef9bb65b9f71b94f21.tar.xz
(svn r4007) Add a function to make a farm field tile
-rw-r--r--clear_map.h13
-rw-r--r--industry_cmd.c7
2 files changed, 13 insertions, 7 deletions
diff --git a/clear_map.h b/clear_map.h
index 69941f209..b383e3639 100644
--- a/clear_map.h
+++ b/clear_map.h
@@ -52,7 +52,18 @@ static inline void MakeClear(TileIndex t, ClearGround g, uint density)
_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
diff --git a/industry_cmd.c b/industry_cmd.c
index 66db19184..fe0c79213 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -968,12 +968,7 @@ static void PlantFarmField(TileIndex tile)
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);
}