(svn r20712) -Fix [FS#4094]: Do not use new game settings when creating many random industries in the scenario editor.

This commit is contained in:
terkhen 2010-09-01 19:04:06 +00:00
parent efef4becbd
commit 5df8e6abcf
1 changed files with 5 additions and 3 deletions

View File

@ -1844,7 +1844,8 @@ static uint32 GetScaledIndustryProbability(IndustryType it, bool *force_at_least
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 @@ static uint32 GetScaledIndustryProbability(IndustryType it, bool *force_at_least
* 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 @@ static void PlaceInitialIndustry(IndustryType type, bool try_hard)
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;