summaryrefslogtreecommitdiff
path: root/clear_map.h
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 /clear_map.h
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 'clear_map.h')
-rw-r--r--clear_map.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/clear_map.h b/clear_map.h
index 5769443a1..8dfed21ce 100644
--- a/clear_map.h
+++ b/clear_map.h
@@ -83,6 +83,17 @@ static inline void SetFieldType(TileIndex t, uint f)
SB(_m[t].m3, 0, 4, f);
}
+static inline uint16 GetIndustryIndexOfField(TileIndex t)
+{
+ assert(GetClearGround(t) == CLEAR_FIELDS);
+ return _m[t].m2;
+}
+
+static inline void SetIndustryIndexOfField(TileIndex t, uint16 i)
+{
+ assert(GetClearGround(t) == CLEAR_FIELDS);
+ _m[t].m2 = i;
+}
/* Is used by tree tiles, too */
static inline uint GetFenceSE(TileIndex t)
@@ -121,11 +132,11 @@ static inline void MakeClear(TileIndex t, ClearGround g, uint density)
}
-static inline void MakeField(TileIndex t, uint field_type)
+static inline void MakeField(TileIndex t, uint field_type, uint16 industry)
{
SetTileType(t, MP_CLEAR);
SetTileOwner(t, OWNER_NONE);
- _m[t].m2 = 0;
+ _m[t].m2 = industry;
_m[t].m3 = field_type;
_m[t].m4 = 0 << 5 | 0 << 2;
SetClearGroundDensity(t, CLEAR_FIELDS, 3);