1927 house = hs->override; |
1927 house = hs->override; |
1928 hs = GetHouseSpecs(house); |
1928 hs = GetHouseSpecs(house); |
1929 } |
1929 } |
1930 |
1930 |
1931 if ((hs->extra_flags & BUILDING_IS_HISTORICAL) && !_generating_world) continue; |
1931 if ((hs->extra_flags & BUILDING_IS_HISTORICAL) && !_generating_world) continue; |
1932 |
|
1933 if (HasBit(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) { |
|
1934 uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, 0, house, t, tile); |
|
1935 if (callback_res != CALLBACK_FAILED && GB(callback_res, 0, 8) == 0) continue; |
|
1936 } |
|
1937 } |
1932 } |
1938 |
1933 |
1939 if (_cur_year < hs->min_year || _cur_year > hs->max_year) continue; |
1934 if (_cur_year < hs->min_year || _cur_year > hs->max_year) continue; |
1940 |
1935 |
1941 /* Special houses that there can be only one of. */ |
1936 /* Special houses that there can be only one of. */ |
1945 SetBit(oneof, TOWN_HAS_CHURCH); |
1940 SetBit(oneof, TOWN_HAS_CHURCH); |
1946 } else if (hs->building_flags & BUILDING_IS_STADIUM) { |
1941 } else if (hs->building_flags & BUILDING_IS_STADIUM) { |
1947 SetBit(oneof, TOWN_HAS_STADIUM); |
1942 SetBit(oneof, TOWN_HAS_STADIUM); |
1948 } |
1943 } |
1949 |
1944 |
1950 if (HASBITS(t->flags12 , oneof)) continue; |
1945 if (HASBITS(t->flags12, oneof)) continue; |
1951 |
1946 |
1952 /* Make sure there is no slope? */ |
1947 /* Make sure there is no slope? */ |
1953 bool noslope = (hs->building_flags & TILE_NOT_SLOPED) != 0; |
1948 bool noslope = (hs->building_flags & TILE_NOT_SLOPED) != 0; |
1954 if (noslope && slope != SLOPE_FLAT) continue; |
1949 if (noslope && slope != SLOPE_FLAT) continue; |
1955 |
1950 |
1959 if (!CheckTownBuild2House(&tile, t, maxz, noslope, DIAGDIR_SW)) continue; |
1954 if (!CheckTownBuild2House(&tile, t, maxz, noslope, DIAGDIR_SW)) continue; |
1960 } else if (hs->building_flags & TILE_SIZE_1x2) { |
1955 } else if (hs->building_flags & TILE_SIZE_1x2) { |
1961 if (!CheckTownBuild2House(&tile, t, maxz, noslope, DIAGDIR_SE)) continue; |
1956 if (!CheckTownBuild2House(&tile, t, maxz, noslope, DIAGDIR_SE)) continue; |
1962 } else { |
1957 } else { |
1963 /* 1x1 house checks are already done */ |
1958 /* 1x1 house checks are already done */ |
|
1959 } |
|
1960 |
|
1961 if (HasBit(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) { |
|
1962 uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, 0, house, t, tile); |
|
1963 if (callback_res != CALLBACK_FAILED && GB(callback_res, 0, 8) == 0) continue; |
1964 } |
1964 } |
1965 |
1965 |
1966 /* build the house */ |
1966 /* build the house */ |
1967 t->num_houses++; |
1967 t->num_houses++; |
1968 IncreaseBuildingCount(t, house); |
1968 IncreaseBuildingCount(t, house); |