@@ -1169,9 +1169,10 @@ static void TriggerIndustryProduction(In
}
} else {
for (auto ita = std::begin(i->accepted); ita != std::end(i->accepted); ++ita) {
if (ita->waiting == 0) continue;
if (ita->waiting == 0 || !IsValidCargoID(ita->cargo)) continue;
for (auto itp = std::begin(i->produced); itp != std::end(i->produced); ++itp) {
if (!IsValidCargoID(itp->cargo)) continue;
itp->waiting = ClampTo<uint16_t>(itp->waiting + (ita->waiting * indspec->input_cargo_multiplier[ita - std::begin(i->accepted)][itp - std::begin(i->produced)] / 256));
@@ -1122,6 +1122,9 @@ static bool SearchLumberMillTrees(TileIn
*/
static void ChopLumberMillTrees(Industry *i)
{
/* Skip production if cargo slot is invalid. */
if (!IsValidCargoID(i->produced[0].cargo)) return;
/* We only want to cut trees if all tiles are completed. */
for (TileIndex tile_cur : i->location) {
if (i->TileBelongsToIndustry(tile_cur)) {
@@ -1160,6 +1163,7 @@ static void ProduceIndustryGoods(Industr
IndustryBehaviour indbehav = indsp->behaviour;
for (auto &p : i->produced) {
if (!IsValidCargoID(p.cargo)) continue;
p.waiting = ClampTo<uint16_t>(p.waiting + p.rate);
@@ -643,9 +643,11 @@ void IndustryProductionCallback(Industry
if (group->version < 2) {
/* Callback parameters map directly to industry cargo slot indices */
for (uint i = 0; i < group->num_input; i++) {
if (!IsValidCargoID(ind->accepted[i].cargo)) continue;
ind->accepted[i].waiting = ClampTo<uint16_t>(ind->accepted[i].waiting - DerefIndProd(group->subtract_input[i], deref) * multiplier);
for (uint i = 0; i < group->num_output; i++) {
if (!IsValidCargoID(ind->produced[i].cargo)) continue;
ind->produced[i].waiting = ClampTo<uint16_t>(ind->produced[i].waiting + std::max(DerefIndProd(group->add_output[i], deref), 0) * multiplier);
Status change: