MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / EnsureEarlyHouse

Function EnsureEarlyHouse

src/newgrf.cpp:1013–1030  ·  view source on GitHub ↗

* Make sure there is at least one house available in the year 0 for the given * climate / housezone combination. * @param bitmask The climate and housezone to check for. Exactly one climate * bit and one housezone bit should be set. */

Source from the content-addressed store, hash-verified

1011 * bit and one housezone bit should be set.
1012 */
1013static void EnsureEarlyHouse(HouseZones bitmask)
1014{
1015 TimerGameCalendar::Year min_year = CalendarTime::MAX_YEAR;
1016
1017 for (const auto &hs : HouseSpec::Specs()) {
1018 if (!hs.enabled) continue;
1019 if (!hs.building_availability.All(bitmask)) continue;
1020 if (hs.min_year < min_year) min_year = hs.min_year;
1021 }
1022
1023 if (min_year == 0) return;
1024
1025 for (auto &hs : HouseSpec::Specs()) {
1026 if (!hs.enabled) continue;
1027 if (!hs.building_availability.All(bitmask)) continue;
1028 if (hs.min_year == min_year) hs.min_year = CalendarTime::MIN_YEAR;
1029 }
1030}
1031
1032/**
1033 * Add all new houses to the house array. House properties can be set at any

Callers 1

FinaliseHouseArrayFunction · 0.85

Calls 1

AllMethod · 0.80

Tested by

no test coverage detected