* Check if a house can be built here, based on slope, whether there's a bridge above, and if we can clear the land. * @param tile The tile to check. * @param noslope Are foundations prohibited for this house? * @return true iff house can be built here. */
| 2585 | * @return true iff house can be built here. |
| 2586 | */ |
| 2587 | static inline bool CanBuildHouseHere(TileIndex tile, bool noslope) |
| 2588 | { |
| 2589 | /* cannot build on these slopes... */ |
| 2590 | Slope slope = GetTileSlope(tile); |
| 2591 | if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope)) return false; |
| 2592 | |
| 2593 | /* at least one RoadTypes allow building the house here? */ |
| 2594 | if (!RoadTypesAllowHouseHere(tile)) return false; |
| 2595 | |
| 2596 | /* building under a bridge? */ |
| 2597 | if (IsBridgeAbove(tile)) return false; |
| 2598 | |
| 2599 | /* can we clear the land? */ |
| 2600 | return Command<CMD_LANDSCAPE_CLEAR>::Do({DoCommandFlag::Auto, DoCommandFlag::NoWater}, tile).Succeeded(); |
| 2601 | } |
| 2602 | |
| 2603 | |
| 2604 | /** |
no test coverage detected