From: Ben Waters Date: Mon, 16 Apr 2018 00:03:07 +0000 (-0400) Subject: Issue-1618 : add button to disconnect from server X-Git-Tag: xonotic-v0.8.5~2171^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F554%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git Issue-1618 : add button to disconnect from server --- diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join.qc b/qcsrc/menu/xonotic/dialog_multiplayer_join.qc index a34d0d80a..cd75a0ab5 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_join.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_join.qc @@ -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; diff --git a/qcsrc/menu/xonotic/serverlist.qc b/qcsrc/menu/xonotic/serverlist.qc index 503a975c3..eec56ca5f 100644 --- a/qcsrc/menu/xonotic/serverlist.qc +++ b/qcsrc/menu/xonotic/serverlist.qc @@ -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 == "")); diff --git a/qcsrc/menu/xonotic/serverlist.qh b/qcsrc/menu/xonotic/serverlist.qh index 32359ad2b..74f3bd570 100644 --- a/qcsrc/menu/xonotic/serverlist.qh +++ b/qcsrc/menu/xonotic/serverlist.qh @@ -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);