]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a checkbox to filter high latency servers (enabled by default with a ping limit...
authorMario <mario.mario@y7mail.com>
Fri, 6 Nov 2020 14:41:49 +0000 (14:41 +0000)
committerMario <mario.mario@y7mail.com>
Fri, 6 Nov 2020 14:41:49 +0000 (14:41 +0000)
qcsrc/menu/xonotic/dialog_multiplayer_join.qc
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/serverlist.qh
xonotic-client.cfg

index c79b124d66659f43e062e39341d5e4125b86b68e..d023221bd5c34d29e10bad72dcf782871e0b4a55 100644 (file)
@@ -36,7 +36,7 @@ void XonoticServerListTab_fill(entity me)
                        slist.controlledTextbox = e;
 
        me.gotoRC(me, 0.5, 2.6);
-               me.TD(me, 1, 0.9, e = makeXonoticCheckBox(0, "menu_slist_categories", ZCTX(_("SRVS^Categories"))));
+               me.TD(me, 1, 0.75, e = makeXonoticCheckBox(0, "menu_slist_categories", ZCTX(_("SRVS^Categories"))));
                        e.onClickEntity = slist;
                        e.onClick = ServerList_Categories_Click;
                me.TD(me, 1, 0.6, e = makeXonoticCheckBox_T(0, "menu_slist_showempty", ZCTX(_("SRVS^Empty")),
@@ -44,11 +44,16 @@ void XonoticServerListTab_fill(entity me)
                        slist.filterShowEmpty = e.checked;
                        e.onClickEntity = slist;
                        e.onClick = ServerList_ShowEmpty_Click;
-               me.TD(me, 1, 0.6, e = makeXonoticCheckBox_T(0, "menu_slist_showfull", ZCTX(_("SRVS^Full")),
+               me.TD(me, 1, 0.5, e = makeXonoticCheckBox_T(0, "menu_slist_showfull", ZCTX(_("SRVS^Full")),
                        _("Show full servers that have no slots available")));
                        slist.filterShowFull = e.checked;
                        e.onClickEntity = slist;
                        e.onClick = ServerList_ShowFull_Click;
+               me.TD(me, 1, 0.6, e = makeXonoticCheckBox_T(0, "menu_slist_showlaggy", ZCTX(_("SRVS^Laggy")),
+                       _("Show high latency servers")));
+                       slist.filterShowLaggy = e.checked;
+                       e.onClickEntity = slist;
+                       e.onClick = ServerList_ShowLaggy_Click;
                me.TD(me, 1, 0.6, e = makeXonoticCheckBox_T(0, "net_slist_pause", _("Pause"),
                        _("Pause updating the server list to prevent servers from \"jumping around\"")));
                me.TD(me, 1, 1, e = makeXonoticButton_T(_("Refresh"), '0 0 0', _("Reload the server list")));
index 578e1eca6f35c9deb4900a49caec0f01dba2ad20..b0f561d91efced1358ca4efc8a9155b70c484df9 100644 (file)
@@ -341,6 +341,10 @@ void XonoticServerList_refreshServerList(entity me, int mode)
                if(!me.filterShowEmpty)
                        sethostcachemasknumber(++m, SLIST_FIELD_NUMHUMANS, 1, SLIST_TEST_GREATEREQUAL);
 
+               // show laggy button
+               if(!me.filterShowLaggy && autocvar_menu_slist_maxping > 0)
+                       sethostcachemasknumber(++m, SLIST_FIELD_PING, autocvar_menu_slist_maxping, SLIST_TEST_LESSEQUAL);
+
                // gametype filtering
                if(typestr != "")
                        sethostcachemaskstring(++m, SLIST_FIELD_QCSTATUS, strcat(typestr, ":"), SLIST_TEST_STARTSWITH);
@@ -679,6 +683,15 @@ void ServerList_ShowFull_Click(entity box, entity me)
        me.ipAddressBox.cursorPos = 0;
        me.ipAddressBoxFocused = -1;
 }
+void ServerList_ShowLaggy_Click(entity box, entity me)
+{
+       box.setChecked(box, me.filterShowLaggy = !me.filterShowLaggy);
+       me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
+
+       me.ipAddressBox.setText(me.ipAddressBox, "");
+       me.ipAddressBox.cursorPos = 0;
+       me.ipAddressBoxFocused = -1;
+}
 void XonoticServerList_setSortOrder(entity me, int fld, int direction)
 {
        if(me.currentSortField == fld)
index 8ad1856b07986ba5477b1f5a6b104e7ed486cab4..77236e6d051d3590021ec1d35851e647053c850e 100644 (file)
@@ -37,6 +37,7 @@ CLASS(XonoticServerList, XonoticListBox)
        METHOD(XonoticServerList, setSortOrder, void(entity, float, float));
        ATTRIB(XonoticServerList, filterShowEmpty, float, 1);
        ATTRIB(XonoticServerList, filterShowFull, float, 1);
+       ATTRIB(XonoticServerList, filterShowLaggy, float, 0);
        ATTRIB(XonoticServerList, filterString, string);
        ATTRIB(XonoticServerList, controlledTextbox, entity);
        ATTRIB(XonoticServerList, ipAddressBox, entity);
@@ -76,6 +77,7 @@ void ServerList_Filter_Change(entity box, entity me);
 void ServerList_Categories_Click(entity box, entity me);
 void ServerList_ShowEmpty_Click(entity box, entity me);
 void ServerList_ShowFull_Click(entity box, entity me);
+void ServerList_ShowLaggy_Click(entity box, entity me);
 void ServerList_Connect_Click(entity btn, entity me);
 void ServerList_Update_favoriteButton(entity btn, entity me);
 void ServerList_Favorite_Click(entity btn, entity me);
@@ -108,6 +110,7 @@ float autocvar_menu_slist_categories;
 float autocvar_menu_slist_categories_onlyifmultiple;
 float autocvar_menu_slist_purethreshold;
 float autocvar_menu_slist_modimpurity;
+float autocvar_menu_slist_maxping = 300;
 float autocvar_menu_slist_recommendations;
 float autocvar_menu_slist_recommendations_maxping;
 float autocvar_menu_slist_recommendations_minfreeslots;
index ac5212408fc613a0f192a7fea3bb9c2da846a8cf..bf1735e0240655e9cdf937e7208222c2e5a290cc 100644 (file)
@@ -532,12 +532,14 @@ seta accuracy_color2 "0 1 0"
 // for menu server list (eventually make them have engine support?)
 seta menu_slist_showfull 1 "show servers even if they are full and have no slots to join"
 seta menu_slist_showempty 1 "show servers even if they are no empty and have no opponents to play against"
+seta menu_slist_showlaggy 0 "show servers even if they are very high latency (see menu_slist_maxping)"
 seta menu_slist_modfilter "" // set to either: !modname or modname. modname of = means "same as we are running now".
 
 // other serverlist cvars
 seta menu_slist_categories 1
 seta menu_slist_categories_onlyifmultiple 1
 seta menu_slist_purethreshold 0
+seta menu_slist_maxping 300
 seta menu_slist_modimpurity 0
 seta menu_slist_recommendations 3
 seta menu_slist_recommendations_maxping 150