mirror of https://github.com/OpenTTD/OpenTTD.git
(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:
parent
efef4becbd
commit
5df8e6abcf
|
@ -1844,7 +1844,8 @@ static uint32 GetScaledIndustryProbability(IndustryType it, bool *force_at_least
|
||||||
const IndustrySpec *ind_spc = GetIndustrySpec(it);
|
const IndustrySpec *ind_spc = GetIndustrySpec(it);
|
||||||
uint32 chance = ind_spc->appear_creation[_settings_game.game_creation.landscape] * 16; // * 16 to increase precision
|
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 ||
|
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;
|
*force_at_least_one = false;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} 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. */
|
* 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);
|
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;
|
return chance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1891,7 +1892,8 @@ static void PlaceInitialIndustry(IndustryType type, bool try_hard)
|
||||||
void GenerateIndustries()
|
void GenerateIndustries()
|
||||||
{
|
{
|
||||||
assert(_settings_game.difficulty.number_industries < lengthof(_numof_industry_table));
|
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? */
|
/* Do not create any industries? */
|
||||||
if (total_amount == 0) return;
|
if (total_amount == 0) return;
|
||||||
|
|
Loading…
Reference in New Issue