Add setting to only spawn primary industries

pull/661/head
Jonathan G Rennison 3 months ago
parent c7e95d5b03
commit b38321b9b4

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

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

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

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

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

Loading…
Cancel
Save