tron@2981: /* $Id$ */ tron@2981: tron@2981: #ifndef TREE_H tron@2981: #define TREE_H tron@2981: tron@2981: #include "macros.h" tron@2981: tron@2981: typedef enum TreeType { tron@2981: TR_INVALID = -1, tron@2981: TR_TEMPERATE = 0, tron@2981: TR_SUB_ARCTIC = 12, tron@2981: TR_RAINFOREST = 20, tron@2981: TR_CACTUS = 27, tron@2981: TR_SUB_TROPICAL = 28, tron@2981: TR_TOYLAND = 32 tron@2981: } TreeType; tron@2981: tron@2981: enum { tron@2981: TR_COUNT_TEMPERATE = TR_SUB_ARCTIC - TR_TEMPERATE, tron@2981: TR_COUNT_SUB_ARCTIC = TR_RAINFOREST - TR_SUB_ARCTIC, tron@2981: TR_COUNT_RAINFOREST = TR_CACTUS - TR_RAINFOREST, tron@2981: TR_COUNT_SUB_TROPICAL = TR_SUB_TROPICAL - TR_CACTUS, tron@2981: TR_COUNT_TOYLAND = 9 tron@2981: }; tron@2981: tron@2981: /* ground type, m2 bits 4...5 tron@2981: * valid densities (bits 6...7) in comments after the enum */ tron@2981: typedef enum TreeGround { tron@2981: TR_GRASS = 0, // 0 tron@2981: TR_ROUGH = 1, // 0 tron@2981: TR_SNOW_DESERT = 2 // 0-3 for snow, 3 for desert tron@2981: } TreeGround; tron@2981: tron@2981: static inline TreeType GetTreeType(TileIndex t) { return _m[t].m3; } tron@2981: static inline void SetTreeType(TileIndex t, TreeType r) { _m[t].m3 = r; } tron@2981: tron@2981: static inline TreeGround GetTreeGround(TileIndex t) { return GB(_m[t].m2, 4, 2); } tron@2981: tron@2981: static inline uint GetTreeDensity(TileIndex t) { return GB(_m[t].m2, 6, 2); } tron@2981: tron@2981: static inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d) tron@2981: { tron@2981: SB(_m[t].m2, 4, 2, g); tron@2981: SB(_m[t].m2, 6, 2, d); tron@2981: } tron@2981: tron@2981: static inline void AddTreeCount(TileIndex t, int c) { _m[t].m5 += c << 6; } tron@2981: static inline uint GetTreeCount(TileIndex t) { return GB(_m[t].m5, 6, 2); } tron@2981: static inline void SetTreeCount(TileIndex t, uint c) { SB(_m[t].m5, 6, 2, c); } tron@2981: tron@2981: static inline void AddTreeGrowth(TileIndex t, int a) { _m[t].m5 += a; } tron@2981: static inline uint GetTreeGrowth(TileIndex t) { return GB(_m[t].m5, 0, 3); } tron@2981: static inline void SetTreeGrowth(TileIndex t, uint g) { SB(_m[t].m5, 0, 3, g); } tron@2981: tron@2981: static inline void AddTreeCounter(TileIndex t, int a) { _m[t].m2 += a; } tron@2981: static inline uint GetTreeCounter(TileIndex t) { return GB(_m[t].m2, 0, 4); } tron@2981: static inline void SetTreeCounter(TileIndex t, uint c) { SB(_m[t].m2, 0, 4, c); } tron@2981: tron@2981: #endif