summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2020-01-06 00:41:00 +0000
committerCharles Pigott <charlespigott@googlemail.com>2020-01-12 19:37:43 +0000
commit87700bfe0e16f7403dbed5468525989b337cf7f6 (patch)
treef6e92c67b5c277d54f8dc1dccaac80c27dfaaeda
parentd35f35a9682518769b13c8b576f4e69ceb0385d9 (diff)
downloadopenttd-87700bfe0e16f7403dbed5468525989b337cf7f6.tar.xz
Codechange: Use cached town name for town list window filtering
-rw-r--r--src/town_gui.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 1dcd65cb5..bc65322ba 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -686,8 +686,6 @@ private:
void BuildSortTownList()
{
if (this->towns.NeedRebuild()) {
- char buf[MAX_LENGTH_TOWN_NAME_CHARS * MAX_CHAR_LENGTH];
-
this->towns.clear();
for (const Town *t : Town::Iterate()) {
@@ -696,11 +694,7 @@ private:
continue;
}
this->string_filter.ResetState();
-
- SetDParam(0, t->index);
- GetString(buf, STR_TOWN_NAME, lastof(buf));
-
- this->string_filter.AddLine(buf);
+ this->string_filter.AddLine(t->GetCachedName());
if (this->string_filter.GetState()) this->towns.push_back(t);
}