From ca818794ab7709adc272f67e8f78c362bdf1ddce Mon Sep 17 00:00:00 2001 From: dP Date: Sun, 28 Sep 2025 19:46:26 +0500 Subject: [PATCH] Fix crash in unserved industries zoning --- src/citymania/cm_highlight.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/citymania/cm_highlight.cpp b/src/citymania/cm_highlight.cpp index 98b484143c..d0254f3b8f 100644 --- a/src/citymania/cm_highlight.cpp +++ b/src/citymania/cm_highlight.cpp @@ -1741,11 +1741,10 @@ SpriteID GetIndustryZoningPalette(TileIndex tile) { Industry *ind = Industry::GetByTile(tile); auto n_produced = 0; auto n_serviced = 0; - for (auto j = 0; j < INDUSTRY_NUM_OUTPUTS; j++) { - if (ind->produced[j].cargo == CT_INVALID) continue; - if (ind->produced[j].history[LAST_MONTH].production == 0 && ind->produced[j].history[THIS_MONTH].production == 0) continue; + for (auto &pc : ind->produced) { + if (pc.history[LAST_MONTH].production == 0 && pc.history[THIS_MONTH].production == 0) continue; n_produced++; - if (ind->produced[j].history[LAST_MONTH].transported > 0 || ind->produced[j].history[THIS_MONTH].transported > 0) + if (pc.history[LAST_MONTH].transported > 0 || pc.history[THIS_MONTH].transported > 0) n_serviced++; } if (n_serviced < n_produced)