Changeset - r24348:2d4209d6c5e0
[Not reviewed]
master
0 1 0
frosch - 4 years ago 2020-09-20 20:30:04
frosch@openttd.org
Fix #8311, b98c7763de4: Industry probability at map generation was scaled differently when set via property or callback.
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -2079,13 +2079,14 @@ static Industry *CreateNewIndustry(TileI
 
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);
0 comments (0 inline, 0 general)