From 8813a798e7db7bc79c99b64cbd6ccaf84bbe3fa9 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Thu, 27 Feb 2025 19:21:43 +0000 Subject: [PATCH] Codechange: Always pass raw strings to TextFilter's AddLine(). (#13666) Remove StringID overload, so callers have to preformat the string. --- src/settingentry_gui.cpp | 7 +++---- src/stringfilter.cpp | 26 -------------------------- src/stringfilter_type.h | 3 +-- 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/src/settingentry_gui.cpp b/src/settingentry_gui.cpp index b4b711f77b..5a4b97cf95 100644 --- a/src/settingentry_gui.cpp +++ b/src/settingentry_gui.cpp @@ -234,9 +234,8 @@ bool SettingEntry::UpdateFilterState(SettingFilter &filter, bool force_visible) /* Process the search text filter for this item. */ filter.string.ResetState(); - SetDParam(0, STR_EMPTY); - filter.string.AddLine(sd->GetTitle()); - filter.string.AddLine(sd->GetHelp()); + filter.string.AddLine(GetString(sd->GetTitle(), STR_EMPTY)); + filter.string.AddLine(GetString(sd->GetHelp())); visible = filter.string.GetState(); } @@ -530,7 +529,7 @@ bool SettingsPage::UpdateFilterState(SettingFilter &filter, bool force_visible) { if (!force_visible && !filter.string.IsEmpty()) { filter.string.ResetState(); - filter.string.AddLine(this->title); + filter.string.AddLine(GetString(this->title)); force_visible = filter.string.GetState(); } diff --git a/src/stringfilter.cpp b/src/stringfilter.cpp index 1696b4239f..539a95fca4 100644 --- a/src/stringfilter.cpp +++ b/src/stringfilter.cpp @@ -123,29 +123,3 @@ void StringFilter::AddLine(const char *str) } } } - -/** - * Pass another text line from the current item to the filter. - * - * You can call this multiple times for a single item, if the filter shall apply to multiple things. - * Before processing the next item you have to call ResetState(). - * - * @param str Another line from the item. - */ -void StringFilter::AddLine(const std::string &str) -{ - AddLine(str.c_str()); -} - -/** - * Pass another text line from the current item to the filter. - * - * You can call this multiple times for a single item, if the filter shall apply to multiple things. - * Before processing the next item you have to call ResetState(). - * - * @param str Another line from the item. - */ -void StringFilter::AddLine(StringID str) -{ - AddLine(GetString(str)); -} diff --git a/src/stringfilter_type.h b/src/stringfilter_type.h index 14283addd2..a4f6c8c03a 100644 --- a/src/stringfilter_type.h +++ b/src/stringfilter_type.h @@ -58,8 +58,7 @@ public: void ResetState(); void AddLine(const char *str); - void AddLine(const std::string &str); - void AddLine(StringID str); + void AddLine(const std::string &str) { this->AddLine(str.c_str()); } /** * Get the matching state of the current item.