bool TileHasTree(TileIndex t, void *user_data) { TreeType found_tree = *(TreeType*)user_data; if (IsValidTile(t) && IsTileType(t, MP_TREES)) { found_tree = GetTreeType(t); } return false; } static void PlaceTree(TileIndex tile, uint32 r) { TreeType tree = TREE_INVALID; CircularTileSearch(&tile, 2, TileHasTree, &tree); if (tree == TREE_INVALID) { tree = GetRandomTreeType(tile, GB(r, 24, 8)); }