Change: Decouple and remove landscape-dependent cargo types. (#11719)
Cargo types of default engines, industries and houses are now specified in terms of label.
This commit is contained in:
@@ -982,7 +982,7 @@ bool IsTileForestIndustry(TileIndex tile)
|
||||
if ((GetIndustrySpec(ind->type)->life_type & INDUSTRYLIFE_ORGANIC) == 0) return false;
|
||||
|
||||
/* Check for wood production */
|
||||
return std::any_of(std::begin(ind->produced), std::end(ind->produced), [](const auto &p) { return IsValidCargoID(p.cargo) && CargoSpec::Get(p.cargo)->label == 'WOOD'; });
|
||||
return std::any_of(std::begin(ind->produced), std::end(ind->produced), [](const auto &p) { return IsValidCargoID(p.cargo) && CargoSpec::Get(p.cargo)->label == CT_WOOD; });
|
||||
}
|
||||
|
||||
static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6};
|
||||
@@ -1869,7 +1869,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||
uint maxcargoes = (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) ? static_cast<uint>(i->accepted.size()) : 3;
|
||||
for (uint j = 0; j < maxcargoes; j++) {
|
||||
uint16_t res = GetIndustryCallback(CBID_INDUSTRY_INPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
|
||||
if (res == CALLBACK_FAILED || GB(res, 0, 8) == CT_INVALID) break;
|
||||
if (res == CALLBACK_FAILED || GB(res, 0, 8) == UINT8_MAX) break;
|
||||
if (indspec->grf_prop.grffile->grf_version >= 8 && res >= 0x100) {
|
||||
ErrorUnknownCallbackResult(indspec->grf_prop.grffile->grfid, CBID_INDUSTRY_INPUT_CARGO_TYPES, res);
|
||||
break;
|
||||
@@ -1901,7 +1901,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||
uint maxcargoes = (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) ? static_cast<uint>(i->produced.size()) : 2;
|
||||
for (uint j = 0; j < maxcargoes; j++) {
|
||||
uint16_t res = GetIndustryCallback(CBID_INDUSTRY_OUTPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
|
||||
if (res == CALLBACK_FAILED || GB(res, 0, 8) == CT_INVALID) break;
|
||||
if (res == CALLBACK_FAILED || GB(res, 0, 8) == UINT8_MAX) break;
|
||||
if (indspec->grf_prop.grffile->grf_version >= 8 && res >= 0x100) {
|
||||
ErrorUnknownCallbackResult(indspec->grf_prop.grffile->grfid, CBID_INDUSTRY_OUTPUT_CARGO_TYPES, res);
|
||||
break;
|
||||
@@ -2877,7 +2877,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
|
||||
|
||||
/* Prevent production to overflow or Oil Rig passengers to be over-"produced" */
|
||||
new_prod = Clamp(new_prod, 1, 255);
|
||||
if (p.cargo == CT_PASSENGERS && !(indspec->behaviour & INDUSTRYBEH_NO_PAX_PROD_CLAMP)) {
|
||||
if (IsValidCargoID(p.cargo) && p.cargo == GetCargoIDByLabel(CT_PASSENGERS) && !(indspec->behaviour & INDUSTRYBEH_NO_PAX_PROD_CLAMP)) {
|
||||
new_prod = Clamp(new_prod, 0, 16);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user