Loading

Paste #p528iusnc

  1. bool TileHasTree(TileIndex t, void *user_data)
  2. {
  3.     TreeType found_tree = *(TreeType*)user_data;
  4.  
  5.     if (IsValidTile(t) && IsTileType(t, MP_TREES)) {
  6.         found_tree = GetTreeType(t);
  7.     }
  8.  
  9.     return false;
  10. }
  11.  
  12.  
  13.  
  14.  
  15.  
  16. static void PlaceTree(TileIndex tile, uint32 r)
  17. {
  18.     TreeType tree = TREE_INVALID;
  19.     CircularTileSearch(&tile, 2, TileHasTree, &tree);
  20.  
  21.     if (tree == TREE_INVALID) {
  22.         tree = GetRandomTreeType(tile, GB(r, 24, 8));
  23.     }

Comments