Fix #2689 "Welcome dialog is not closed by voting screens or by disconnecting" master
authorterencehill <piuntn@gmail.com>
Wed, 18 May 2022 10:21:44 +0000 (12:21 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 18 May 2022 10:25:46 +0000 (12:25 +0200)
qcsrc/client/main.qc
qcsrc/menu/xonotic/dialog_welcome.qc

index 8bd5d78638c1fc607fd379d7d1b20d82d0b52ca9..091cc466183efecd96bda5291383c2aab720acda 100644 (file)
@@ -1438,6 +1438,8 @@ void Welcome_Message_Show_Try()
                        string msg = MakeConsoleSafe(strreplace("\n", "\\n", welcome_msg));
                        welcomedialog_args = strcat(welcomedialog_args, " WELCOME \"", msg, "\"");
                        localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n");
+                       if (intermission) // close it after it's been initialized so it can still be opened manually
+                               localcmd("\ntogglemenu 0\n");
                }
                else
                        centerprint_Add(ORDINAL(CPID_MOTD), strcat(hostname, "\n\n\n", welcome_msg), -1, 0);
index ca80ef4dd780241e2c971810972628fd7a60a979..5da6f8b1ea9a0bb30aba0786c0bba645f59f2d3b 100644 (file)
@@ -71,6 +71,10 @@ void XonoticWelcomeDialog_readInputArgs(entity me, int argsbuf)
 void XonoticWelcomeDialog_draw(entity me)
 {
        SUPER(XonoticWelcomeDialog).draw(me);
+
+       if (!(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)))
+               me.close(me);
+
        if(me.serverinfo_MOTD == "" && gamestatus & (GAME_CONNECTED | GAME_ISSERVER))
        {
                // if serverinfo_MOTD is empty while connected it means we are connected to an old server