summaryrefslogtreecommitdiff
path: root/tree.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-02-24 20:38:08 +0000
committertron <tron@openttd.org>2006-02-24 20:38:08 +0000
commitdd26e1f19762cb231bc09d59adae222bbf429c61 (patch)
treea035158877d14491bbb48f0b042e5c01e94bb8c7 /tree.h
parentc18791022e065a9c124f97f88262cc0937676fcc (diff)
downloadopenttd-dd26e1f19762cb231bc09d59adae222bbf429c61.tar.xz
(svn r3668) Add a function to turn a tile into a tree tile
Diffstat (limited to 'tree.h')
-rw-r--r--tree.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/tree.h b/tree.h
index 943fcacf1..10ca11f05 100644
--- a/tree.h
+++ b/tree.h
@@ -56,4 +56,15 @@ static inline void AddTreeCounter(TileIndex t, int a) { _m[t].m2 += a; }
static inline uint GetTreeCounter(TileIndex t) { return GB(_m[t].m2, 0, 4); }
static inline void SetTreeCounter(TileIndex t, uint c) { SB(_m[t].m2, 0, 4, c); }
+
+static inline void MakeTree(TileIndex t, TreeType type, uint count, uint growth, TreeGround ground, uint density)
+{
+ SetTileType(t, MP_TREES);
+ SetTileOwner(t, OWNER_NONE);
+ _m[t].m2 = density << 6 | ground << 4 | 0;
+ _m[t].m3 = type;
+ _m[t].m4 = 0 << 5 | 0 << 2;
+ _m[t].m5 = count << 6 | growth;
+}
+
#endif