* Returns the bit corresponding to the town zone of the specified tile. * @param t Town on which town zone is to be found. * @param tile TileIndex where town zone needs to be found. * @return the bit position of the given zone, as defined in HouseZones. */
| 2514 | * @return the bit position of the given zone, as defined in HouseZones. |
| 2515 | */ |
| 2516 | HouseZone GetTownRadiusGroup(const Town *t, TileIndex tile) |
| 2517 | { |
| 2518 | uint dist = DistanceSquare(tile, t->xy); |
| 2519 | |
| 2520 | if (t->fund_buildings_months != 0 && dist <= 25) return HouseZone::TownCentre; |
| 2521 | |
| 2522 | HouseZone smallest = HouseZone::TownEdge; |
| 2523 | for (HouseZone i : HZ_ZONE_ALL) { |
| 2524 | if (dist < t->cache.squared_town_zone_radius[to_underlying(i)]) smallest = i; |
| 2525 | } |
| 2526 | |
| 2527 | return smallest; |
| 2528 | } |
| 2529 | |
| 2530 | /** |
| 2531 | * Clears tile and builds a house or house part. |
no test coverage detected