Codechange: Use LRUCache for layouted LineCache.

This avoids needing to manually manage the size of the cache.
This commit is contained in:
Peter Nelson
2025-05-04 09:40:00 +01:00
committed by Peter Nelson
parent 8c4f8af66e
commit 9735fbbaa1
5 changed files with 94 additions and 53 deletions

View File

@@ -137,10 +137,6 @@ bool GenerateTownName(Randomizer &randomizer, uint32_t *townnameparts, TownNames
{
TownNameParams par(_settings_game.game_creation.town_name);
/* This function is called very often without entering the gameloop
* in between. So reset layout cache to prevent it from growing too big. */
Layouter::ReduceLineCache();
/* Do not set i too low, since when we run out of names, we loop
* for #tries only one time anyway - then we stop generating more
* towns. Do not set it too high either, since looping through all