mirror of https://github.com/OpenTTD/OpenTTD
(svn r26346) -Fix [FS#5870]: Call Layouter::ReduceLineCache from GenerateTownName in all cases.
parent
20785c79fc
commit
55502341ac
|
@ -46,7 +46,6 @@
|
||||||
#include "object_base.h"
|
#include "object_base.h"
|
||||||
#include "ai/ai.hpp"
|
#include "ai/ai.hpp"
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
#include "gfx_layout.h"
|
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "table/town_land.h"
|
#include "table/town_land.h"
|
||||||
|
@ -1909,13 +1908,6 @@ bool GenerateTowns(TownLayout layout)
|
||||||
* 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 {
|
||||||
if (total % 512 == 0) {
|
|
||||||
/* Clear the caches regularly, otherwise it will only be done
|
|
||||||
* at the end of the whole cycle when OpenTTD has allocated
|
|
||||||
* lots and lots of memory for these essentially caches. */
|
|
||||||
Layouter::ReduceLineCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool city = (_settings_game.economy.larger_towns != 0 && Chance16(1, _settings_game.economy.larger_towns));
|
bool city = (_settings_game.economy.larger_towns != 0 && Chance16(1, _settings_game.economy.larger_towns));
|
||||||
IncreaseGeneratingWorldProgress(GWP_TOWN);
|
IncreaseGeneratingWorldProgress(GWP_TOWN);
|
||||||
/* Get a unique name for the town. */
|
/* Get a unique name for the town. */
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "strings_func.h"
|
#include "strings_func.h"
|
||||||
#include "core/random_func.hpp"
|
#include "core/random_func.hpp"
|
||||||
#include "genworld.h"
|
#include "genworld.h"
|
||||||
|
#include "gfx_layout.h"
|
||||||
|
|
||||||
#include "table/townname.h"
|
#include "table/townname.h"
|
||||||
|
|
||||||
|
@ -125,6 +126,10 @@ bool GenerateTownName(uint32 *townnameparts, TownNames *town_names)
|
||||||
* too much). */
|
* too much). */
|
||||||
TownNameParams par(_settings_game.game_creation.town_name);
|
TownNameParams par(_settings_game.game_creation.town_name);
|
||||||
|
|
||||||
|
/* This function is called very often without entering the gameloop
|
||||||
|
* inbetween. So reset layout cache to prevent it from growing too big. */
|
||||||
|
Layouter::ReduceLineCache();
|
||||||
|
|
||||||
for (int i = 1000; i != 0; i--) {
|
for (int i = 1000; i != 0; i--) {
|
||||||
uint32 r = _generating_world ? Random() : InteractiveRandom();
|
uint32 r = _generating_world ? Random() : InteractiveRandom();
|
||||||
if (!VerifyTownName(r, &par, town_names)) continue;
|
if (!VerifyTownName(r, &par, town_names)) continue;
|
||||||
|
|
Loading…
Reference in New Issue