Mercurial > hg > openttd
changeset 16017:0906e67b6ea6 draft
(svn r20710) -Codechange: Clarify the name of some town generation variables.
author | terkhen <terkhen@openttd.org> |
---|---|
date | Wed, 01 Sep 2010 18:52:27 +0000 |
parents | 68db5e7ccacc |
children | f6bb3f37feb7 |
files | src/town_cmd.cpp |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1773,12 +1773,12 @@ */ bool GenerateTowns(TownLayout layout) { - uint num = 0; + uint current_number = 0; uint difficulty = _settings_game.difficulty.number_towns; - uint n = (difficulty == (uint)CUSTOM_TOWN_NUMBER_DIFFICULTY) ? _settings_game.game_creation.custom_town_number : ScaleByMapSize(_num_initial_towns[difficulty] + (Random() & 7)); + uint total = (difficulty == (uint)CUSTOM_TOWN_NUMBER_DIFFICULTY) ? _settings_game.game_creation.custom_town_number : ScaleByMapSize(_num_initial_towns[difficulty] + (Random() & 7)); uint32 townnameparts; - SetGeneratingWorldProgress(GWP_TOWN, n); + SetGeneratingWorldProgress(GWP_TOWN, total); /* First attempt will be made at creating the suggested number of towns. * Note that this is really a suggested value, not a required one. @@ -1789,12 +1789,12 @@ /* Get a unique name for the town. */ if (!GenerateTownName(&townnameparts)) continue; /* try 20 times to create a random-sized town for the first loop. */ - if (CreateRandomTown(20, townnameparts, TSZ_RANDOM, city, layout) != NULL) num++; // If creation was successful, raise a flag. - } while (--n); - - if (num != 0) return true; - - /* If num is still zero at this point, it means that not a single town has been created. + if (CreateRandomTown(20, townnameparts, TSZ_RANDOM, city, layout) != NULL) current_number++; // If creation was successful, raise a flag. + } while (--total); + + if (current_number != 0) return true; + + /* If current_number is still zero at this point, it means that not a single town has been created. * So give it a last try, but now more aggressive */ if (GenerateTownName(&townnameparts) && CreateRandomTown(10000, townnameparts, TSZ_RANDOM, _settings_game.economy.larger_towns != 0, layout) != NULL) {