From 7afa667e664bf2777225cb184999b09c6a8d2d5b Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 6 Jan 2020 00:41:00 +0000 Subject: [PATCH] Use town cached name for town list window filtering --- src/town_gui.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/town_gui.cpp b/src/town_gui.cpp index ce718a8f79..44f32972a1 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -979,8 +979,6 @@ public: */ void OnInvalidateData(int data = 0, bool gui_scope = true) override { - char buf[MAX_LENGTH_TOWN_NAME_CHARS * MAX_CHAR_LENGTH]; - switch (data) { case TDIWD_FORCE_REBUILD: /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ @@ -996,11 +994,7 @@ public: const Town *t; FOR_ALL_TOWNS(t) { 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); }