]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement reliable detection of the Welcome dialog availability
authorterencehill <piuntn@gmail.com>
Sat, 12 Mar 2022 14:16:44 +0000 (15:16 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 12 Mar 2022 14:16:44 +0000 (15:16 +0100)
qcsrc/client/main.qc
qcsrc/menu/xonotic/dialog_welcome.qc
qcsrc/menu/xonotic/dialog_welcome.qh

index dde1467e69991a9cc2355071f1c9c2e6e5064486..42330a36d6102edcfdd737df5d24099bc79c1abf 100644 (file)
@@ -1290,10 +1290,7 @@ NET_HANDLE(TE_CSQC_SERVERINFO, bool isNew)
 {
        string hostname = ReadString();
        string msg = ReadString();
-       // players running older Xonotic version without the Welocome dialog have the cvar
-       // cl_welcome_in_menu_dialog not saved because it was created by the relative autocvar
-       // initilaization when server's client program is run
-       if (cvar_type("cl_welcome_in_menu_dialog") & CVAR_TYPEFLAG_SAVED && autocvar_cl_welcome_in_menu_dialog)
+       if (cvar("_menu_welcome_dialog_available") && autocvar_cl_welcome_in_menu_dialog)
        {
                string welcomedialog_args;
                welcomedialog_args = strcat("name \"", hostname, "\"");
index 86ba9a7949ddf69a5a1c25de3b4210e8340fa557..252ff93226b0a68a6de49dea90ed20afaef68241 100644 (file)
@@ -36,6 +36,13 @@ void XonoticWelcomeDialog_configureDialog(entity me)
 {
        welcomeDialog_resetStrings(me);
        SUPER(XonoticWelcomeDialog).configureDialog(me);
+       registercvar("_menu_welcome_dialog_available", "0", 0);
+       cvar_set("_menu_welcome_dialog_available", "1");
+}
+
+void XonoticWelcomeDialog_destroy(entity me)
+{
+       cvar_set("_menu_welcome_dialog_available", "0");
 }
 
 void XonoticWelcomeDialog_readInputArgs(entity me, float argsbuf)
index bc6c06d829ea39b6c95ea6383e3a1253edeb627a..05652cfaa0739eefeabfe59555b06165b08a7fb4 100644 (file)
@@ -12,6 +12,7 @@ CLASS(XonoticWelcomeDialog, XonoticRootDialog)
 
        METHOD(XonoticWelcomeDialog, keyDown, float(entity, float, float, float));
        METHOD(XonoticWelcomeDialog, configureDialog, void(entity));
+       METHOD(XonoticWelcomeDialog, destroy, void(entity));
        METHOD(XonoticWelcomeDialog, readInputArgs, void(entity, float));
        ATTRIB(XonoticWelcomeDialog, serverinfo_name, string, string_null);
        //ATTRIB(XonoticWelcomeDialog, serverinfo_name_ent, entity, world);