From eab98e4808132ef01d0122ccedb2999fc3ad0d2c Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 11 Jan 2022 20:56:09 +0000 Subject: [PATCH] Industry::this_month_production should saturate instead of overflowing --- src/industry_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index df315e779b..c74d9c1a12 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -544,7 +544,7 @@ static bool TransportIndustryGoods(TileIndex tile) /* fluctuating economy? */ if (EconomyIsInRecession()) cw = (cw + 1) / 2; - i->this_month_production[j] += cw; + i->this_month_production[j] = std::min(i->this_month_production[j] + cw, 0xFFFF); uint am = MoveGoodsToStation(i->produced_cargo[j], cw, ST_INDUSTRY, i->index, &i->stations_near, i->exclusive_consumer); i->this_month_transported[j] += am;