diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 5052f31410..1374eb776b 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -2368,6 +2368,7 @@ static uint32_t GetScaledIndustryGenerationProbability(IndustryType it, bool *fo uint32_t chance = ind_spc->appear_creation[_settings_game.game_creation.landscape]; if (!ind_spc->enabled || ind_spc->layouts.empty() || (_game_mode != GM_EDITOR && _settings_game.difficulty.industry_density == ID_FUND_ONLY) || + (_settings_game.economy.spawn_primary_industry_only && !ind_spc->IsRawIndustry()) || (chance = GetIndustryProbabilityCallback(it, IACT_MAPGENERATION, chance)) == 0) { *force_at_least_one = false; return 0; @@ -2396,6 +2397,11 @@ static uint16_t GetIndustryGamePlayProbability(IndustryType it, byte *min_number } const IndustrySpec *ind_spc = GetIndustrySpec(it); + if (_settings_game.economy.spawn_primary_industry_only && !ind_spc->IsRawIndustry()) { + *min_number = 0; + return 0; + } + byte chance = ind_spc->appear_ingame[_settings_game.game_creation.landscape]; if (!ind_spc->enabled || ind_spc->layouts.empty() || ((ind_spc->behaviour & INDUSTRYBEH_BEFORE_1950) && CalTime::CurYear() > 1950) || diff --git a/src/lang/extra/english.txt b/src/lang/extra/english.txt index 88830c12a6..86b17dfaab 100644 --- a/src/lang/extra/english.txt +++ b/src/lang/extra/english.txt @@ -727,6 +727,9 @@ STR_CONFIG_SETTING_IGNORE_OBJECT_INTRO_DATES_HELPTEXT :Set whether pla STR_CONFIG_SETTING_ALLOW_CONVERT_TOWN_ROAD_NO_HOUSES :Allow converting town roads to non-house types: {STRING2} STR_CONFIG_SETTING_ALLOW_CONVERT_TOWN_ROAD_NO_HOUSES_HELPTEXT :Whether to allow players to convert town-owned roads to a road type which does not allow houses.{}This is off by default because doing so can prevent towns from building houses at all, resulting in them shrinking. +STR_CONFIG_SETTING_SPAWN_PRIMARY_INDUSTRY_ONLY :Only generate primary industries: {STRING2} +STR_CONFIG_SETTING_SPAWN_PRIMARY_INDUSTRY_ONLY_HELPTEXT :If enabled, only primary industries are generated during game play and map generation. + STR_PURCHASE_LAND_PERMITTED_NO :No STR_PURCHASE_LAND_PERMITTED_SINGLE :Yes, 1 tile at a time STR_PURCHASE_LAND_PERMITTED_AREA :Yes, large areas at a time diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index b4745737ba..65f194f4b5 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -2650,6 +2650,7 @@ static SettingsContainer &GetSettingsTree() industries->Add(new SettingEntry("economy.type")); industries->Add(new SettingEntry("station.serve_neutral_industries")); industries->Add(new SettingEntry("station.station_delivery_mode")); + industries->Add(new SettingEntry("economy.spawn_primary_industry_only")); } SettingsPage *cdist = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_CARGODIST)); diff --git a/src/settings_type.h b/src/settings_type.h index bd286b9647..2ab0e33f33 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -736,6 +736,7 @@ struct EconomySettings { bool give_money; ///< allow giving other companies money bool mod_road_rebuild; ///< roadworks remove unnecessary RoadBits bool multiple_industry_per_town; ///< allow many industries of the same type per town + bool spawn_primary_industry_only; ///< only spawn primary industried int8_t town_growth_rate; ///< town growth rate uint8_t town_growth_cargo_transported; ///< percentage of town growth rate which depends on proportion of transported cargo in the last month bool town_zone_calc_mode; ///< calc mode for town zones diff --git a/src/table/settings/economy_settings.ini b/src/table/settings/economy_settings.ini index 297399f957..61db37857f 100644 --- a/src/table/settings/economy_settings.ini +++ b/src/table/settings/economy_settings.ini @@ -245,6 +245,13 @@ def = false str = STR_CONFIG_SETTING_MULTIPINDTOWN strhelp = STR_CONFIG_SETTING_MULTIPINDTOWN_HELPTEXT +[SDT_BOOL] +var = economy.spawn_primary_industry_only +flags = SF_PATCH +def = false +str = STR_CONFIG_SETTING_SPAWN_PRIMARY_INDUSTRY_ONLY +strhelp = STR_CONFIG_SETTING_SPAWN_PRIMARY_INDUSTRY_ONLY_HELPTEXT + [SDT_BOOL] var = economy.bribe def = true