* Tests if a tile can be converted to MP_TREES * This is true for clear ground without farms or rocks. * * @param tile the tile of interest * @param allow_desert Allow planting trees on CLEAR_DESERT? * @return true if trees can be built. */
| 57 | * @return true if trees can be built. |
| 58 | */ |
| 59 | static bool CanPlantTreesOnTile(TileIndex tile, bool allow_desert) |
| 60 | { |
| 61 | switch (GetTileType(tile)) { |
| 62 | case MP_WATER: |
| 63 | return !IsBridgeAbove(tile) && IsCoast(tile) && !IsSlopeWithOneCornerRaised(GetTileSlope(tile)); |
| 64 | |
| 65 | case MP_CLEAR: |
| 66 | return !IsBridgeAbove(tile) && !IsClearGround(tile, CLEAR_FIELDS) && !IsClearGround(tile, CLEAR_ROCKS) && |
| 67 | (allow_desert || !IsClearGround(tile, CLEAR_DESERT)); |
| 68 | |
| 69 | default: return false; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Creates a tree tile |
no test coverage detected