summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-09-01 19:04:06 +0000
committerterkhen <terkhen@openttd.org>2010-09-01 19:04:06 +0000
commit5df8e6abcfe1a4dcf1d8c6d574f9d2493c49000c (patch)
treefe17e333366ae428212a7ff9cfd2db7cc01be46c /src/industry_cmd.cpp
parentefef4becbd33a50682692659949f4c1f8177cd27 (diff)
downloadopenttd-5df8e6abcfe1a4dcf1d8c6d574f9d2493c49000c.tar.xz
(svn r20712) -Fix [FS#4094]: Do not use new game settings when creating many random industries in the scenario editor.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 525af5322..acfcc3aa8 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -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;