diff options
author | frosch <frosch@openttd.org> | 2014-02-16 17:45:24 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2014-02-16 17:45:24 +0000 |
commit | 55502341ac4975e2e5bf0661b094fa3d4e7fe890 (patch) | |
tree | b9af05a42afcf280c0141d06090749b666a0717f /src/townname.cpp | |
parent | 20785c79fc2437683eb59ebdf98dde0ce1863c2c (diff) | |
download | openttd-55502341ac4975e2e5bf0661b094fa3d4e7fe890.tar.xz |
(svn r26346) -Fix [FS#5870]: Call Layouter::ReduceLineCache from GenerateTownName in all cases.
Diffstat (limited to 'src/townname.cpp')
-rw-r--r-- | src/townname.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/townname.cpp b/src/townname.cpp index 136882103..ad9b26fee 100644 --- a/src/townname.cpp +++ b/src/townname.cpp @@ -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; |