]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'issue-1618-Add-Disconnect-button' into 'master'
authorMario <zacjardine@y7mail.com>
Thu, 26 Apr 2018 07:35:45 +0000 (07:35 +0000)
committerMario <zacjardine@y7mail.com>
Thu, 26 Apr 2018 07:35:45 +0000 (07:35 +0000)
Issue-1618 : add button to disconnect from server

Closes #1618

See merge request xonotic/xonotic-data.pk3dir!554

qcsrc/menu/xonotic/dialog_multiplayer_join.qc
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/serverlist.qh

index a34d0d80a1cb12a9e713efb213d147b5f272226d..cd75a0ab55bddf41e4b2560933a785e8c14729ba 100644 (file)
@@ -81,7 +81,10 @@ void XonoticServerListTab_fill(entity me)
                        e.onClickEntity = slist;
                        slist.infoButton = e;
        me.TR(me);
-               me.TD(me, 1, me.columns, e = makeXonoticButton(_("Join!"), '0 0 0'));
+               me.TD(me, 1, 1, e = makeXonoticCommandButton_T(_("Disconnect"), '0 0 0', "echo disconnect\ndisconnect", 0,
+                       _("Disconnecting from server")));
+                       slist.disconnectButton = e;
+               me.TD(me, 1, me.columns-1, e = makeXonoticButton(_("Join!"), '0 0 0'));
                        e.onClick = ServerList_Connect_Click;
                        e.onClickEntity = slist;
                        slist.connectButton = e;
index 503a975c326fe09ba82aab79ac0b5131d6cb41a5..eec56ca5fd56725c7106d0ba246f8f70396d104f 100644 (file)
@@ -546,6 +546,7 @@ void XonoticServerList_draw(entity me)
        else { me.nItems = gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT); }
 
        me.connectButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
+       me.disconnectButton.disabled = (!(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)));
        me.infoButton.disabled = (me.lockedSelectedItem || me.nItems == 0 || !owned);
        me.favoriteButton.disabled = (me.lockedSelectedItem || (me.nItems == 0 && me.ipAddressBox.text == ""));
 
index 32359ad2b22edf9abf652201b8e8c6a6b199c217..74f3bd570d5fee88efdcdbab3fbdaa341c2545a6 100644 (file)
@@ -52,6 +52,7 @@ CLASS(XonoticServerList, XonoticListBox)
        ATTRIB(XonoticServerList, sortButton4, entity);
        ATTRIB(XonoticServerList, sortButton5, entity);
        ATTRIB(XonoticServerList, connectButton, entity);
+       ATTRIB(XonoticServerList, disconnectButton, entity);
        ATTRIB(XonoticServerList, infoButton, entity);
        ATTRIB(XonoticServerList, currentSortOrder, float, 0);
        ATTRIB(XonoticServerList, currentSortField, float, -1);