1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-27 06:04:25 +01:00

(svn r17079) [0.7] -Backport from trunk:

- Change: Add notion of Ctrl_Click in the tooltip for Loan borrow/repay buttons [FS#3066] (r16979)
- Fix: Make it so that failing to generate many random towns in scenario editor returns a failing message [FS#3059] (r16977)
- Change: [MSVC] Make all language files depend on english.txt (r16975)
- Change: There is no point in not randomising engine introduction-date before 1922. Instead disable the randomisation for the first two years after game-start, so you do not have to wait for the first engine (r16929)
- Fix: The last manually added server would not be saved [FS#3062] (r16981)
This commit is contained in:
rubidium
2009-08-05 23:49:30 +00:00
parent 645664eced
commit fa713d0e3b
9 changed files with 113 additions and 107 deletions

View File

@@ -1621,6 +1621,12 @@ Town *CreateRandomTown(uint attempts, TownSize size, bool city, TownLayout layou
static const byte _num_initial_towns[4] = {5, 11, 23, 46}; // very low, low, normal, high
/** This function will generate a certain amount of towns, with a certain layout
* It can be called from the scenario editor (i.e.: generate Random Towns)
* as well as from world creation.
* @param layout which towns will be set to, when created
* @return true if towns have been successfully created
*/
bool GenerateTowns(TownLayout layout)
{
uint num = 0;
@@ -1629,25 +1635,27 @@ bool GenerateTowns(TownLayout layout)
SetGeneratingWorldProgress(GWP_TOWN, n);
/* First attempt will be made at creating the suggested number of towns.
* 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? */
do {
bool city = (_settings_game.economy.larger_towns != 0 && Chance16(1, _settings_game.economy.larger_towns));
IncreaseGeneratingWorldProgress(GWP_TOWN);
/* try 20 times to create a random-sized town for the first loop. */
if (CreateRandomTown(20, TS_RANDOM, city, layout) != NULL) num++;
if (CreateRandomTown(20, TS_RANDOM, city, layout) != NULL) num++; // if creation successfull, raise a flag
} while (--n);
/* give it a last try, but now more aggressive */
/* If num 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 (num == 0 && CreateRandomTown(10000, TS_RANDOM, _settings_game.economy.larger_towns != 0, layout) == NULL) {
if (GetNumTowns() == 0) {
if (_game_mode != GM_EDITOR) {
extern StringID _switch_mode_errorstr;
_switch_mode_errorstr = STR_COULD_NOT_CREATE_TOWN;
}
return false;
}
return false; // we are still without a town? we failed, simply
}
return true;
}