* Set climate mask for filtering buildings from current landscape. */
| 1450 | * Set climate mask for filtering buildings from current landscape. |
| 1451 | */ |
| 1452 | void SetClimateMask() |
| 1453 | { |
| 1454 | this->climate_mask = GetClimateMaskForLandscape(); |
| 1455 | |
| 1456 | /* In some cases, not all 'classes' (house zones) have distinct houses, so we need to disable those. |
| 1457 | * As we need to check all types, and this cannot change with the picker window open, pre-calculate it. |
| 1458 | * This loop calls GetTypeName() instead of directly checking properties so that there is no discrepancy. */ |
| 1459 | this->class_mask = 0; |
| 1460 | |
| 1461 | int num_classes = this->GetClassCount(); |
| 1462 | for (int cls_id = 0; cls_id < num_classes; ++cls_id) { |
| 1463 | int num_types = this->GetTypeCount(cls_id); |
| 1464 | for (int id = 0; id < num_types; ++id) { |
| 1465 | if (this->GetTypeName(cls_id, id) != INVALID_STRING_ID) { |
| 1466 | SetBit(this->class_mask, cls_id); |
| 1467 | break; |
| 1468 | } |
| 1469 | } |
| 1470 | } |
| 1471 | } |
| 1472 | |
| 1473 | HouseZones climate_mask{}; |
| 1474 | uint8_t class_mask = 0; ///< Mask of available 'classes'. |
no test coverage detected