diff options
author | frosch <frosch@openttd.org> | 2010-02-06 20:50:50 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-02-06 20:50:50 +0000 |
commit | 3c7dff4270f83fa8e84f23a38c94f3a4c5b26942 (patch) | |
tree | 769d1517dcbb51b68581b89265312370c6949460 /src | |
parent | 69184fdc79d58fa82a6e4baa53dfe35e0239548e (diff) | |
download | openttd-3c7dff4270f83fa8e84f23a38c94f3a4c5b26942.tar.xz |
(svn r19051) -Codechange: Variable scope.
Diffstat (limited to 'src')
-rw-r--r-- | src/industry_cmd.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 4ec994fb3..7738fc305 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1802,21 +1802,16 @@ static void PlaceInitialIndustry(IndustryType type, uint amount) * It will scale the amount of industries by map size as well as difficulty level */ void GenerateIndustries() { - uint i = 0; - uint8 chance; - IndustryType it; - const IndustrySpec *ind_spc; - + uint total_amount = 0; uint industry_counts[NUM_INDUSTRYTYPES]; memset(industry_counts, 0, sizeof(industry_counts)); /* Find the total amount of industries */ if (_settings_game.difficulty.number_industries > 0) { - for (it = 0; it < NUM_INDUSTRYTYPES; it++) { - - ind_spc = GetIndustrySpec(it); + for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) { + const IndustrySpec *ind_spc = GetIndustrySpec(it); - chance = ind_spc->appear_creation[_settings_game.game_creation.landscape]; + uint8 chance = ind_spc->appear_creation[_settings_game.game_creation.landscape]; if (ind_spc->enabled && chance > 0 && ind_spc->num_table > 0 && CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION)) { /* once the chance of appearance is determind, it have to be scaled by * the difficulty level. The "chance" in question is more an index into @@ -1826,15 +1821,15 @@ void GenerateIndustries() /* These are always placed next to the coastline, so we scale by the perimeter instead. */ num = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num); industry_counts[it] = num; - i += num; + total_amount += num; } } } - SetGeneratingWorldProgress(GWP_INDUSTRY, i); + SetGeneratingWorldProgress(GWP_INDUSTRY, total_amount); if (_settings_game.difficulty.number_industries > 0) { - for (it = 0; it < NUM_INDUSTRYTYPES; it++) { + for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) { /* Once the number of industries has been determined, let's really create them. */ if (industry_counts[it] > 0) PlaceInitialIndustry(it, industry_counts[it]); } |