mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-31 11:23:21 +00:00
Using an actual random chance to generate cities means that there may be far less or far more than 'expected' towns being made as cities. While this is the point of randomness, the wording of the setting is "Proporation of towns that will become cities: 1 in X" and does not mention randomness at all.
This commit is contained in:
parent
e45e8a39c8
commit
d450d4743e
@ -2395,11 +2395,15 @@ bool GenerateTowns(TownLayout layout)
|
|||||||
town_names.insert(town->GetCachedName());
|
town_names.insert(town->GetCachedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Randomised offset for city status. This means with e.g. 1-in-4 towns being cities, a map with 10 towns
|
||||||
|
* may have 2 or 3 cities, instead of always 3. */
|
||||||
|
uint city_random_offset = Random() % _settings_game.economy.larger_towns;
|
||||||
|
|
||||||
/* First attempt will be made at creating the suggested number of towns.
|
/* First attempt will be made at creating the suggested number of towns.
|
||||||
* Note that this is really a suggested value, not a required one.
|
* Note that this is really a suggested value, not a required one.
|
||||||
* We would not like the system to lock up just because the user wanted 100 cities on a 64*64 map, would we? */
|
* We would not like the system to lock up just because the user wanted 100 cities on a 64*64 map, would we? */
|
||||||
do {
|
do {
|
||||||
bool city = (_settings_game.economy.larger_towns != 0 && Chance16(1, _settings_game.economy.larger_towns));
|
bool city = (_settings_game.economy.larger_towns != 0 && ((city_random_offset + current_number) % _settings_game.economy.larger_towns) == 0);
|
||||||
IncreaseGeneratingWorldProgress(GWP_TOWN);
|
IncreaseGeneratingWorldProgress(GWP_TOWN);
|
||||||
/* Get a unique name for the town. */
|
/* Get a unique name for the town. */
|
||||||
if (!GenerateTownName(_random, &townnameparts, &town_names)) continue;
|
if (!GenerateTownName(_random, &townnameparts, &town_names)) continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user