src/tree_map.h
changeset 10363 96eb6897bf96
parent 9111 48ce04029fe4
equal deleted inserted replaced
10362:20518cacbdb8 10363:96eb6897bf96
   142  * @pre Tile must be of type MP_TREES
   142  * @pre Tile must be of type MP_TREES
   143  */
   143  */
   144 static inline uint GetTreeCount(TileIndex t)
   144 static inline uint GetTreeCount(TileIndex t)
   145 {
   145 {
   146 	assert(IsTileType(t, MP_TREES));
   146 	assert(IsTileType(t, MP_TREES));
   147 	return GB(_m[t].m5, 6, 2);
   147 	return GB(_m[t].m5, 6, 2) + 1;
   148 }
   148 }
   149 
   149 
   150 /**
   150 /**
   151  * Add a amount to the tree-count value of a tile with trees.
   151  * Add a amount to the tree-count value of a tile with trees.
   152  *
   152  *
   160  */
   160  */
   161 static inline void AddTreeCount(TileIndex t, int c)
   161 static inline void AddTreeCount(TileIndex t, int c)
   162 {
   162 {
   163 	assert(IsTileType(t, MP_TREES)); // XXX incomplete
   163 	assert(IsTileType(t, MP_TREES)); // XXX incomplete
   164 	_m[t].m5 += c << 6;
   164 	_m[t].m5 += c << 6;
   165 }
       
   166 
       
   167 /**
       
   168  * Sets the tree amount of a tile.
       
   169  *
       
   170  * This function directly sets the amount of trees of a tile.
       
   171  *
       
   172  * @param t The tile to set the amount of trees
       
   173  * @param c The number of trees
       
   174  * @pre Tile must be of type MP_TREES
       
   175  */
       
   176 static inline void SetTreeCount(TileIndex t, uint c)
       
   177 {
       
   178 	assert(IsTileType(t, MP_TREES)); // XXX incomplete
       
   179 	SB(_m[t].m5, 6, 2, c);
       
   180 }
   165 }
   181 
   166 
   182 /**
   167 /**
   183  * Returns the tree growth status.
   168  * Returns the tree growth status.
   184  *
   169  *