(svn r26346) -Fix [FS#5870]: Call Layouter::ReduceLineCache from GenerateTownName in all cases.

This commit is contained in:
frosch
2014-02-16 17:45:24 +00:00
parent 20785c79fc
commit 55502341ac
2 changed files with 5 additions and 8 deletions

View File

@@ -16,6 +16,7 @@
#include "strings_func.h"
#include "core/random_func.hpp"
#include "genworld.h"
#include "gfx_layout.h"
#include "table/townname.h"
@@ -125,6 +126,10 @@ bool GenerateTownName(uint32 *townnameparts, TownNames *town_names)
* too much). */
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--) {
uint32 r = _generating_world ? Random() : InteractiveRandom();
if (!VerifyTownName(r, &par, town_names)) continue;