Add setting to scale primary industry cargo production

pull/211/head
Jonathan G Rennison 3 years ago
parent c7fa284db4
commit 8ac436f507

@ -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) {

@ -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);
}
}
}

@ -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

@ -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
};

@ -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

@ -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));

@ -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

@ -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]

Loading…
Cancel
Save