2981
|
1 |
/* $Id$ */
|
|
2 |
|
|
3 |
#ifndef TREE_H
|
|
4 |
#define TREE_H
|
|
5 |
|
|
6 |
#include "macros.h"
|
|
7 |
|
|
8 |
typedef enum TreeType {
|
|
9 |
TR_INVALID = -1,
|
|
10 |
TR_TEMPERATE = 0,
|
|
11 |
TR_SUB_ARCTIC = 12,
|
|
12 |
TR_RAINFOREST = 20,
|
|
13 |
TR_CACTUS = 27,
|
|
14 |
TR_SUB_TROPICAL = 28,
|
|
15 |
TR_TOYLAND = 32
|
|
16 |
} TreeType;
|
|
17 |
|
|
18 |
enum {
|
|
19 |
TR_COUNT_TEMPERATE = TR_SUB_ARCTIC - TR_TEMPERATE,
|
|
20 |
TR_COUNT_SUB_ARCTIC = TR_RAINFOREST - TR_SUB_ARCTIC,
|
|
21 |
TR_COUNT_RAINFOREST = TR_CACTUS - TR_RAINFOREST,
|
|
22 |
TR_COUNT_SUB_TROPICAL = TR_SUB_TROPICAL - TR_CACTUS,
|
|
23 |
TR_COUNT_TOYLAND = 9
|
|
24 |
};
|
|
25 |
|
|
26 |
/* ground type, m2 bits 4...5
|
|
27 |
* valid densities (bits 6...7) in comments after the enum */
|
|
28 |
typedef enum TreeGround {
|
|
29 |
TR_GRASS = 0, // 0
|
|
30 |
TR_ROUGH = 1, // 0
|
|
31 |
TR_SNOW_DESERT = 2 // 0-3 for snow, 3 for desert
|
|
32 |
} TreeGround;
|
|
33 |
|
|
34 |
static inline TreeType GetTreeType(TileIndex t) { return _m[t].m3; }
|
|
35 |
static inline void SetTreeType(TileIndex t, TreeType r) { _m[t].m3 = r; }
|
|
36 |
|
|
37 |
static inline TreeGround GetTreeGround(TileIndex t) { return GB(_m[t].m2, 4, 2); }
|
|
38 |
|
|
39 |
static inline uint GetTreeDensity(TileIndex t) { return GB(_m[t].m2, 6, 2); }
|
|
40 |
|
|
41 |
static inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d)
|
|
42 |
{
|
|
43 |
SB(_m[t].m2, 4, 2, g);
|
|
44 |
SB(_m[t].m2, 6, 2, d);
|
|
45 |
}
|
|
46 |
|
|
47 |
static inline void AddTreeCount(TileIndex t, int c) { _m[t].m5 += c << 6; }
|
|
48 |
static inline uint GetTreeCount(TileIndex t) { return GB(_m[t].m5, 6, 2); }
|
|
49 |
static inline void SetTreeCount(TileIndex t, uint c) { SB(_m[t].m5, 6, 2, c); }
|
|
50 |
|
|
51 |
static inline void AddTreeGrowth(TileIndex t, int a) { _m[t].m5 += a; }
|
|
52 |
static inline uint GetTreeGrowth(TileIndex t) { return GB(_m[t].m5, 0, 3); }
|
|
53 |
static inline void SetTreeGrowth(TileIndex t, uint g) { SB(_m[t].m5, 0, 3, g); }
|
|
54 |
|
|
55 |
static inline void AddTreeCounter(TileIndex t, int a) { _m[t].m2 += a; }
|
|
56 |
static inline uint GetTreeCounter(TileIndex t) { return GB(_m[t].m2, 0, 4); }
|
|
57 |
static inline void SetTreeCounter(TileIndex t, uint c) { SB(_m[t].m2, 0, 4, c); }
|
|
58 |
|
|
59 |
#endif
|