diff options
author | frosch <frosch@openttd.org> | 2020-09-20 22:30:04 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-09-24 19:29:52 +0200 |
commit | df5362a0083b571d0b8eb2879b618c3edbf9e7fc (patch) | |
tree | 860441cad848479ac828197204430887f5031005 | |
parent | 0110fa12daabecfaa5e6454ba6f93b8024db552e (diff) | |
download | openttd-df5362a0083b571d0b8eb2879b618c3edbf9e7fc.tar.xz |
Fix #8311, b98c7763de4: Industry probability at map generation was scaled differently when set via property or callback.
-rw-r--r-- | src/industry_cmd.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index bd1d28ef6..443702993 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -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); |