diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index e25b7c2f37..b5ecc4a208 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1193,7 +1193,11 @@ static void ProduceIndustryGoods(Industry *i) IndustryBehaviour indbehav = indsp->behaviour; for (size_t j = 0; j < lengthof(i->produced_cargo_waiting); j++) { - i->produced_cargo_waiting[j] = min(0xffff, i->produced_cargo_waiting[j] + i->production_rate[j]); + uint amount = i->production_rate[j]; + if (amount != 0) { + amount = ScaleQuantity(amount, _settings_game.economy.industry_cargo_scale_factor); + } + i->produced_cargo_waiting[j] = min(0xffff, i->produced_cargo_waiting[j] + amount); } if ((indbehav & INDUSTRYBEH_PLANT_FIELDS) != 0) { diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 3b8f09c1a0..1e19ca2d54 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -1104,7 +1104,7 @@ static void UpdateIndustryProduction(Industry *i) for (byte j = 0; j < lengthof(i->produced_cargo); j++) { if (i->produced_cargo[j] != CT_INVALID) { - i->last_month_production[j] = 8 * i->production_rate[j]; + i->last_month_production[j] = ScaleQuantity(8 * i->production_rate[j], _settings_game.economy.industry_cargo_scale_factor); } } } diff --git a/src/lang/english.txt b/src/lang/english.txt index a4139834a5..8b1383f52f 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1787,6 +1787,8 @@ STR_CONFIG_SETTING_TOWN_CARGOGENMODE_ORIGINAL :Quadratic (orig STR_CONFIG_SETTING_TOWN_CARGOGENMODE_BITCOUNT :Linear STR_CONFIG_SETTING_TOWN_CARGO_FACTOR :Town cargo generation factor (less < 0 < more): {STRING2} STR_CONFIG_SETTING_TOWN_CARGO_FACTOR_HELPTEXT :Passenger, mail, and other town cargo production is scaled by approximately 2^factor (exponential) +STR_CONFIG_SETTING_INDUSTRY_CARGO_FACTOR :Industry cargo generation factor (less < 0 < more): {STRING2} +STR_CONFIG_SETTING_INDUSTRY_CARGO_FACTOR_HELPTEXT :Primary industry cargo production is scaled by approximately 2^factor (exponential). This excludes tree-cutting industries.{}This is not guaranteed to be fully compatible with all industry NewGRFs. STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT :In game placement of trees: {STRING2} STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_HELPTEXT :Control random appearance of trees during the game. This might affect industries which rely on tree growth, for example lumber mills diff --git a/src/saveload/extended_ver_sl.cpp b/src/saveload/extended_ver_sl.cpp index fa3a2629bd..d890ded0e5 100644 --- a/src/saveload/extended_ver_sl.cpp +++ b/src/saveload/extended_ver_sl.cpp @@ -142,6 +142,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = { { XSLFI_VENC_CHUNK, XSCF_IGNORABLE_ALL, 1, 1, "venc_chunk", nullptr, nullptr, "VENC" }, { XSLFI_ANIMATED_TILE_EXTRA, XSCF_NULL, 1, 1, "animated_tile_extra", nullptr, nullptr, nullptr }, { XSLFI_NEWGRF_INFO_EXTRA, XSCF_NULL, 1, 1, "newgrf_info_extra", nullptr, nullptr, nullptr }, + { XSLFI_INDUSTRY_CARGO_ADJ, XSCF_IGNORABLE_UNKNOWN, 1, 1, "industry_cargo_adj", nullptr, nullptr, nullptr }, { XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker }; diff --git a/src/saveload/extended_ver_sl.h b/src/saveload/extended_ver_sl.h index 3d922cbdcb..e3767c9f0a 100644 --- a/src/saveload/extended_ver_sl.h +++ b/src/saveload/extended_ver_sl.h @@ -96,6 +96,7 @@ enum SlXvFeatureIndex { XSLFI_VENC_CHUNK, ///< VENC chunk XSLFI_ANIMATED_TILE_EXTRA, ///< Animated tile extra info XSLFI_NEWGRF_INFO_EXTRA, ///< Extra NewGRF info in savegame + XSLFI_INDUSTRY_CARGO_ADJ, ///< Industry cargo adjustment patch XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index deac11ea40..0eb4f594ef 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1943,6 +1943,7 @@ static SettingsContainer &GetSettingsTree() industries->Add(new SettingEntry("game_creation.oil_refinery_limit")); industries->Add(new SettingEntry("economy.smooth_economy")); industries->Add(new SettingEntry("station.serve_neutral_industries")); + industries->Add(new SettingEntry("economy.industry_cargo_scale_factor")); } SettingsPage *cdist = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST)); diff --git a/src/settings_type.h b/src/settings_type.h index 7b067193e1..2a4b2cb645 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -598,6 +598,7 @@ struct EconomySettings { bool allow_town_level_crossings; ///< towns are allowed to build level crossings int8 old_town_cargo_factor; ///< old power-of-two multiplier for town (passenger, mail) generation. May be negative. int16 town_cargo_scale_factor; ///< scaled power-of-two multiplier for town (passenger, mail) generation. May be negative. + int16 industry_cargo_scale_factor; ///< scaled power-of-two multiplier for primary industry generation. May be negative. bool infrastructure_maintenance; ///< enable monthly maintenance fee for owner infrastructure uint8 day_length_factor; ///< factor which the length of day is multiplied uint16 random_road_reconstruction; ///< chance out of 1000 per tile loop for towns to start random road re-construction diff --git a/src/table/settings.ini b/src/table/settings.ini index 49ef37bfae..9f2d309cb8 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -1188,6 +1188,20 @@ strval = STR_JUST_DECIMAL1 strhelp = STR_CONFIG_SETTING_TOWN_CARGO_FACTOR_HELPTEXT patxname = ""town_cargo_adj.economy.town_cargo_scale_factor"" +[SDT_VAR] +base = GameSettings +var = economy.industry_cargo_scale_factor +type = SLE_INT16 +guiflags = SGF_DECIMAL1 +def = 0 +min = -160 +max = +80 +interval = 1 +str = STR_CONFIG_SETTING_INDUSTRY_CARGO_FACTOR +strval = STR_JUST_DECIMAL1 +strhelp = STR_CONFIG_SETTING_INDUSTRY_CARGO_FACTOR_HELPTEXT +patxname = ""industry_cargo_adj.economy.industry_cargo_scale_factor"" + ; Vehicles [SDT_VAR]