• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

This is a fork of Zandronum Beta for Mac Os (Silicon and Intel)


Commit MetaInfo

Revision66b94bcd9b8021e0b12f2c9ef90743aa69f1201c (tree)
Time2022-08-22 12:29:43
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Added an option to filter the server list by name within the built-in server browser menu.

Change Summary

Incremental Difference

diff -r 78ebfcf4e52d -r 66b94bcd9b80 src/menu/browsermenu.cpp
--- a/src/menu/browsermenu.cpp Sun Aug 28 15:49:46 2022 +0200
+++ b/src/menu/browsermenu.cpp Sun Aug 21 23:29:43 2022 -0400
@@ -105,6 +105,10 @@
105105 {
106106 M_BuildServerList();
107107 }
108+CUSTOM_CVAR( String, menu_browser_filtername, "", CVAR_ARCHIVE ) // [AK]
109+{
110+ M_BuildServerList();
111+}
108112
109113 // =================================================================================================
110114 //
@@ -479,6 +483,24 @@
479483 return ( false );
480484 }
481485
486+ // [AK] Only show servers containing words that we want to filter in.
487+ if ( strlen( menu_browser_filtername ) > 0 )
488+ {
489+ FString hostName = BROWSER_GetHostName( lServer );
490+ FString filterName = menu_browser_filtername.GetGenericRep( CVAR_String ).String;
491+
492+ // [AK] A filter string that's longer than the server's name obviously means that it can't be shown.
493+ if ( filterName.Len( ) > hostName.Len( ))
494+ return ( false );
495+
496+ // [AK] Set both strings to lowercase first.
497+ hostName.ToLower( );
498+ filterName.ToLower( );
499+
500+ if ( strstr( hostName, filterName ) == NULL )
501+ return ( false );
502+ }
503+
482504 return ( true );
483505 }
484506
@@ -588,6 +610,13 @@
588610 }
589611
590612 //*****************************************************************************
613+// [AK]
614+CCMD ( menu_clear_browser_filter )
615+{
616+ menu_browser_filtername = "";
617+}
618+
619+//*****************************************************************************
591620 //
592621 CCMD ( menu_join_selected_server )
593622 {
diff -r 78ebfcf4e52d -r 66b94bcd9b80 wadsrc/static/menudef.za
--- a/wadsrc/static/menudef.za Sun Aug 28 15:49:46 2022 +0200
+++ b/wadsrc/static/menudef.za Sun Aug 21 23:29:43 2022 -0400
@@ -244,6 +244,7 @@
244244 Option "Sort by", "menu_browser_sortby", "ZA_ServerSortType"
245245 Option "Show empty", "menu_browser_showempty", "YesNo"
246246 Option "Show full", "menu_browser_showfull", "YesNo"
247+ TextField "Filter name", "menu_browser_filtername"
247248 StaticText " "
248249 StaticText " " // Header
249250 StaticText " "
@@ -257,6 +258,7 @@
257258 ServerBrowserSlot 7
258259 StaticText " "
259260 Command "Refresh", "querymaster"
261+ Command "Clear filter", "menu_clear_browser_filter"
260262 Submenu "Get server info", "ZA_ServerInfo"
261263 SafeCommand "Join game!", "menu_join_selected_server"
262264 }