342 IncHouseConstructionTick(tile); |
342 IncHouseConstructionTick(tile); |
343 if (GetHouseConstructionTick(tile) != 0) return; |
343 if (GetHouseConstructionTick(tile) != 0) return; |
344 |
344 |
345 /* Check and/or */ |
345 /* Check and/or */ |
346 if (HASBIT(GetHouseSpecs(GetHouseType(tile))->callback_mask, CBM_CONSTRUCTION_STATE_CHANGE)) { |
346 if (HASBIT(GetHouseSpecs(GetHouseType(tile))->callback_mask, CBM_CONSTRUCTION_STATE_CHANGE)) { |
347 uint16 callback_res = GetHouseCallback(CBID_CONSTRUCTION_STATE_CHANGE, 0, GetHouseType(tile), GetTownByTile(tile), tile); |
347 uint16 callback_res = GetHouseCallback(CBID_CONSTRUCTION_STATE_CHANGE, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile); |
348 if (callback_res != CALLBACK_FAILED) ChangeHouseAnimationFrame(tile, callback_res); |
348 if (callback_res != CALLBACK_FAILED) ChangeHouseAnimationFrame(tile, callback_res); |
349 } |
349 } |
350 |
350 |
351 if (IsHouseCompleted(tile)) { |
351 if (IsHouseCompleted(tile)) { |
352 /* Now that construction is complete, we can add the population of the |
352 /* Now that construction is complete, we can add the population of the |
488 accepts[i] = hs->accepts_cargo[i]; |
488 accepts[i] = hs->accepts_cargo[i]; |
489 } |
489 } |
490 |
490 |
491 /* Check for custom accepted cargo types */ |
491 /* Check for custom accepted cargo types */ |
492 if (HASBIT(hs->callback_mask, CBM_HOUSE_ACCEPT_CARGO)) { |
492 if (HASBIT(hs->callback_mask, CBM_HOUSE_ACCEPT_CARGO)) { |
493 uint16 callback = GetHouseCallback(CBID_HOUSE_ACCEPT_CARGO, 0, GetHouseType(tile), GetTownByTile(tile), tile); |
493 uint16 callback = GetHouseCallback(CBID_HOUSE_ACCEPT_CARGO, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile); |
494 if (callback != CALLBACK_FAILED) { |
494 if (callback != CALLBACK_FAILED) { |
495 /* Replace accepted cargo types with translated values from callback */ |
495 /* Replace accepted cargo types with translated values from callback */ |
496 accepts[0] = GetCargoTranslation(GB(callback, 0, 5), hs->grffile); |
496 accepts[0] = GetCargoTranslation(GB(callback, 0, 5), hs->grffile); |
497 accepts[1] = GetCargoTranslation(GB(callback, 5, 5), hs->grffile); |
497 accepts[1] = GetCargoTranslation(GB(callback, 5, 5), hs->grffile); |
498 accepts[2] = GetCargoTranslation(GB(callback, 10, 5), hs->grffile); |
498 accepts[2] = GetCargoTranslation(GB(callback, 10, 5), hs->grffile); |
499 } |
499 } |
500 } |
500 } |
501 |
501 |
502 /* Check for custom cargo acceptance */ |
502 /* Check for custom cargo acceptance */ |
503 if (HASBIT(hs->callback_mask, CBM_CARGO_ACCEPTANCE)) { |
503 if (HASBIT(hs->callback_mask, CBM_CARGO_ACCEPTANCE)) { |
504 uint16 callback = GetHouseCallback(CBID_HOUSE_CARGO_ACCEPTANCE, 0, GetHouseType(tile), GetTownByTile(tile), tile); |
504 uint16 callback = GetHouseCallback(CBID_HOUSE_CARGO_ACCEPTANCE, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile); |
505 if (callback != CALLBACK_FAILED) { |
505 if (callback != CALLBACK_FAILED) { |
506 if (accepts[0] != CT_INVALID) ac[accepts[0]] = GB(callback, 0, 4); |
506 if (accepts[0] != CT_INVALID) ac[accepts[0]] = GB(callback, 0, 4); |
507 if (accepts[1] != CT_INVALID) ac[accepts[1]] = GB(callback, 4, 4); |
507 if (accepts[1] != CT_INVALID) ac[accepts[1]] = GB(callback, 4, 4); |
508 if (_opt.landscape != LT_TEMPERATE && HASBIT(callback, 12)) { |
508 if (_opt.landscape != LT_TEMPERATE && HASBIT(callback, 12)) { |
509 /* The 'S' bit indicates food instead of goods */ |
509 /* The 'S' bit indicates food instead of goods */ |
1661 if (hs->override != 0) hs = GetHouseSpecs(hs->override); |
1661 if (hs->override != 0) hs = GetHouseSpecs(hs->override); |
1662 |
1662 |
1663 if ((hs->extra_flags & BUILDING_IS_HISTORICAL) && !_generating_world) continue; |
1663 if ((hs->extra_flags & BUILDING_IS_HISTORICAL) && !_generating_world) continue; |
1664 |
1664 |
1665 if (HASBIT(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) { |
1665 if (HASBIT(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) { |
1666 uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, house, t, tile); |
1666 uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, 0, house, t, tile); |
1667 if (callback_res != CALLBACK_FAILED && callback_res == 0) continue; |
1667 if (callback_res != CALLBACK_FAILED && callback_res == 0) continue; |
1668 } |
1668 } |
1669 } |
1669 } |
1670 |
1670 |
1671 if (_cur_year < hs->min_date || _cur_year > hs->max_date) continue; |
1671 if (_cur_year < hs->min_date || _cur_year > hs->max_date) continue; |