From: terencehill Date: Tue, 1 Jun 2021 11:16:41 +0000 (+0200) Subject: Add a quitGameButton to the server list dialogue too X-Git-Tag: xonotic-v0.8.5~129^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=53a02e57ad049e2fc6733a2b16349b6a27501c8e;p=xonotic%2Fxonotic-data.pk3dir.git Add a quitGameButton to the server list dialogue too --- diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join.qc b/qcsrc/menu/xonotic/dialog_multiplayer_join.qc index a65a4945b..2c0847601 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_join.qc +++ b/qcsrc/menu/xonotic/dialog_multiplayer_join.qc @@ -22,6 +22,16 @@ void XonoticServerListTab_refresh(entity this, entity slist) slist.refreshServerList(slist, clear ? REFRESHSERVERLIST_RESET : REFRESHSERVERLIST_ASK); } +.entity quitGameButton; +void XonoticServerListTab_draw(entity me) +{ + entity e = me.quitGameButton; + e.disabled = !(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)); + e.setText(e, quitGameButton_getText(e)); + setZonedTooltip(e, quitGameButton_getTooltip(e), string_null); + SUPER(XonoticServerListTab).draw(me); +} + void XonoticServerListTab_fill(entity me) { entity e, slist; @@ -89,12 +99,8 @@ void XonoticServerListTab_fill(entity me) e.onClickEntity = slist; slist.infoButton = e; me.TR(me); - /* - me.TD(me, 1, 1, e = makeXonoticCommandButton_T(_("Disconnect"), '0 0 0', "disconnect", 0, - _("Disconnect from the server"))); - slist.disconnectButton = e; - */ - me.TD(me, 1, me.columns, e = makeXonoticButton(_("Join!"), '0 0 0')); + me.TD(me, 1, me.columns * 0.5, me.quitGameButton = makeXonoticCommandButton(string_null, '0 0 0', QUITGAME_CMD, 0)); + me.TD(me, 1, me.columns * 0.5, e = makeXonoticButton(_("Join!"), '0 0 0')); e.onClick = ServerList_Connect_Click; e.onClickEntity = slist; slist.connectButton = e; diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_join.qh b/qcsrc/menu/xonotic/dialog_multiplayer_join.qh index a663eb527..33f63209e 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_join.qh +++ b/qcsrc/menu/xonotic/dialog_multiplayer_join.qh @@ -3,6 +3,7 @@ #include "tab.qh" CLASS(XonoticServerListTab, XonoticTab) METHOD(XonoticServerListTab, fill, void(entity)); + METHOD(XonoticServerListTab, draw, void(entity)); ATTRIB(XonoticServerListTab, intendedWidth, float, 0.9); ATTRIB(XonoticServerListTab, rows, float, 23); ATTRIB(XonoticServerListTab, columns, float, 6.5);