]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
Implement reliable detection of the Welcome dialog availability
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index 649def85c615fc859904c25f129d12c2e84ec1cd..42330a36d6102edcfdd737df5d24099bc79c1abf 100644 (file)
@@ -58,7 +58,7 @@ void CSQC_Init()
                maxclients = i;
        }
 
-       ReplicateVars_Send_All();
+       ReplicateVars(REPLICATEVARS_SEND_ALL);
 
        // needs to be done so early because of the constants they create
        static_init();
@@ -190,7 +190,7 @@ void Shutdown()
        deactivate_minigame();
        HUD_MinigameMenu_Close(NULL, NULL, NULL);
 
-       ReplicateVars_Destroy();
+       ReplicateVars(REPLICATEVARS_DESTROY);
 }
 
 void AuditLists()
@@ -1286,6 +1286,23 @@ NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew)
        }
 }
 
+NET_HANDLE(TE_CSQC_SERVERINFO, bool isNew)
+{
+       string hostname = ReadString();
+       string msg = ReadString();
+       if (cvar("_menu_welcome_dialog_available") && autocvar_cl_welcome_in_menu_dialog)
+       {
+               string welcomedialog_args;
+               welcomedialog_args = strcat("name \"", hostname, "\"");
+               msg = MakeConsoleSafe(strreplace("\n", "\\n", msg));
+               welcomedialog_args = strcat(welcomedialog_args, " motd \"", msg, "\"");
+               localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n");
+       }
+       else
+               centerprint_Add(ORDINAL(CPID_MOTD), strcat(hostname, "\n\n\n", msg), -1, 0);
+       return true;
+}
+
 string _getcommandkey(string cmd_name, string command, bool forcename)
 {
        string keys;