|
@@ -1622,16 +1622,9 @@ static void ExtChangeIndustryProduction(
|
|
|
int j;
|
|
|
const IndustrySpec *indspec = GetIndustrySpec(i->type);
|
|
|
|
|
|
switch (indspec->life_type) {
|
|
|
case INDUSTRYLIFE_NOT_CLOSABLE:
|
|
|
return;
|
|
|
if (indspec->life_type == INDUSTRYLIFE_BLACK_HOLE) return;
|
|
|
|
|
|
case INDUSTRYLIFE_CLOSABLE:
|
|
|
if ((byte)(_cur_year - i->last_prod_year) < 5 || !CHANCE16(1, 180))
|
|
|
closeit = false;
|
|
|
break;
|
|
|
|
|
|
default: /* INDUSTRY_PRODUCTION */
|
|
|
if (HASBIT(indspec->life_type, INDUSTRYLIFE_ORGANIC) || HASBIT(indspec->life_type, INDUSTRYLIFE_EXTRACTIVE)) {
|
|
|
for (j = 0; j < 2 && indspec->produced_cargo[j] != CT_INVALID; j++){
|
|
|
uint32 r = Random();
|
|
|
int old_prod, new_prod, percent;
|
|
@@ -1653,7 +1646,7 @@ static void ExtChangeIndustryProduction(
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
percent = new_prod * 100 / old_prod - 100;
|
|
|
percent = (old_prod == 0) ? 100 : (new_prod * 100 / old_prod - 100);
|
|
|
i->production_rate[j] = new_prod;
|
|
|
|
|
|
/* Close the industry when it has the lowest possible production rate */
|
|
@@ -1671,7 +1664,10 @@ static void ExtChangeIndustryProduction(
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
if (HASBIT(indspec->life_type, INDUSTRYLIFE_PROCESSING)) {
|
|
|
if ((byte)(_cur_year - i->last_prod_year) < 5 || !CHANCE16(1, 180)) closeit = false;
|
|
|
}
|
|
|
|
|
|
/* If industry will be closed down, show this */
|
|
@@ -1785,11 +1781,9 @@ static void ChangeIndustryProduction(Ind
|
|
|
int type = i->type;
|
|
|
const IndustrySpec *indspec = GetIndustrySpec(type);
|
|
|
|
|
|
switch (indspec->life_type) {
|
|
|
case INDUSTRYLIFE_NOT_CLOSABLE:
|
|
|
return;
|
|
|
if (indspec->life_type == INDUSTRYLIFE_BLACK_HOLE) return;
|
|
|
|
|
|
case INDUSTRYLIFE_PRODUCTION:
|
|
|
if (HASBIT(indspec->life_type, INDUSTRYLIFE_ORGANIC) || HASBIT(indspec->life_type, INDUSTRYLIFE_EXTRACTIVE)) {
|
|
|
/* decrease or increase */
|
|
|
if ((indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _opt.landscape == LT_TEMPERATE)
|
|
|
only_decrease = true;
|
|
@@ -1829,15 +1823,13 @@ static void ChangeIndustryProduction(Ind
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case INDUSTRYLIFE_CLOSABLE:
|
|
|
}
|
|
|
if (HASBIT(indspec->life_type, INDUSTRYLIFE_PROCESSING)) {
|
|
|
/* maybe close */
|
|
|
if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1, 2)) {
|
|
|
i->prod_level = 0;
|
|
|
str = indspec->closure_text;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
if (str != STR_NULL) {
|