mirror of https://github.com/OpenTTD/OpenTTD
Fix #8311, b98c7763de4: Industry probability at map generation was scaled differently when set via property or callback.
parent
0110fa12da
commit
df5362a008
|
@ -2079,13 +2079,14 @@ static Industry *CreateNewIndustry(TileIndex tile, IndustryType type, IndustryAv
|
|||
static uint32 GetScaledIndustryGenerationProbability(IndustryType it, bool *force_at_least_one)
|
||||
{
|
||||
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];
|
||||
if (!ind_spc->enabled || ind_spc->layouts.empty() ||
|
||||
(_game_mode != GM_EDITOR && _settings_game.difficulty.industry_density == ID_FUND_ONLY) ||
|
||||
(chance = GetIndustryProbabilityCallback(it, IACT_MAPGENERATION, chance)) == 0) {
|
||||
*force_at_least_one = false;
|
||||
return 0;
|
||||
} else {
|
||||
chance *= 16; // to increase precision
|
||||
/* We want industries appearing at coast to appear less often on bigger maps, as length of coast increases slower than map area.
|
||||
* 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);
|
||||
|
|
Loading…
Reference in New Issue