Mercurial > hg > openttd
changeset 16019:d246c7cb2c1f draft
(svn r20712) -Fix [FS#4094]: Do not use new game settings when creating many random industries in the scenario editor.
author | terkhen <terkhen@openttd.org> |
---|---|
date | Wed, 01 Sep 2010 19:04:06 +0000 |
parents | f6bb3f37feb7 |
children | 07a2dff4bfef |
files | src/industry_cmd.cpp |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1844,7 +1844,8 @@ const IndustrySpec *ind_spc = GetIndustrySpec(it); uint32 chance = ind_spc->appear_creation[_settings_game.game_creation.landscape] * 16; // * 16 to increase precision if (!ind_spc->enabled || chance == 0 || ind_spc->num_table == 0 || - !CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION) || _settings_game.difficulty.number_industries == 0) { + !CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION) || + (_game_mode != GM_EDITOR && _settings_game.difficulty.number_industries == 0)) { *force_at_least_one = false; return 0; } else { @@ -1852,7 +1853,7 @@ * For simplicity we scale in both cases, though scaling the probabilities of all industries has no effect. */ chance = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(chance) : ScaleByMapSize(chance); - *force_at_least_one = (chance > 0) && !(ind_spc->behaviour & INDUSTRYBEH_NOBUILT_MAPCREATION); + *force_at_least_one = (chance > 0) && !(ind_spc->behaviour & INDUSTRYBEH_NOBUILT_MAPCREATION) && (_game_mode != GM_EDITOR); return chance; } } @@ -1891,7 +1892,8 @@ void GenerateIndustries() { assert(_settings_game.difficulty.number_industries < lengthof(_numof_industry_table)); - uint total_amount = ScaleByMapSize(_numof_industry_table[_settings_game.difficulty.number_industries]); + uint difficulty = (_game_mode != GM_EDITOR) ? _settings_game.difficulty.number_industries : 1; + uint total_amount = ScaleByMapSize(_numof_industry_table[difficulty]); /* Do not create any industries? */ if (total_amount == 0) return;