From bc45c3f66c6538bc7e048e2b768b76add7bb07be Mon Sep 17 00:00:00 2001 From: PeterN Date: Mon, 22 May 2023 08:03:20 +0100 Subject: [PATCH] Change: Remember waypoint filter string. (#10857) --- src/rail_gui.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index e3ac337845..0ea7272217 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -2001,9 +2001,9 @@ struct BuildRailWaypointWindow : PickerWindowBase { const StationClass *waypoints; WaypointList list; StringFilter string_filter; ///< Filter for waypoint name - QueryString editbox; ///< Filter editbox + static QueryString editbox; ///< Filter editbox - BuildRailWaypointWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent), editbox(FILTER_LENGTH * MAX_CHAR_LENGTH, FILTER_LENGTH) + BuildRailWaypointWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) { this->waypoints = StationClass::Get(STAT_CLASS_WAYP); @@ -2016,6 +2016,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { this->querystrings[WID_BRW_FILTER] = &this->editbox; this->editbox.cancel_button = QueryString::ACTION_CLEAR; + this->string_filter.SetFilterTerm(this->editbox.text.buf); this->list.ForceRebuild(); this->BuildPickerList(); @@ -2170,6 +2171,8 @@ struct BuildRailWaypointWindow : PickerWindowBase { } }; +/* static */ QueryString BuildRailWaypointWindow::editbox(BuildRailWaypointWindow::FILTER_LENGTH * MAX_CHAR_LENGTH, BuildRailWaypointWindow::FILTER_LENGTH); + /** Nested widget definition for the build NewGRF rail waypoint window */ static const NWidgetPart _nested_build_waypoint_widgets[] = { NWidget(NWID_HORIZONTAL),