]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Welcome message: fix broken version check by giving the client time to send its versi...
authorterencehill <piuntn@gmail.com>
Wed, 23 Mar 2022 02:23:14 +0000 (03:23 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 23 Mar 2022 02:23:14 +0000 (03:23 +0100)
qcsrc/client/main.qc
qcsrc/server/client.qc

index 5e04e7160eef5408b273e5554d9ca81b19c25c00..d1f6e1b8d102d67570dd1b2e09a37ed93c94bacf 100644 (file)
@@ -1291,7 +1291,6 @@ NET_HANDLE(TE_CSQC_SERVERINFO, bool isNew)
        bool force_centerprint = ReadByte();
        string hostname = ReadString();
        string ver = ReadString();
-       string gamemode_name = ReadString();
        string modifications = ReadString();
        string cache_mutatormsg = ReadString();
        string mutator_msg = ReadString();
@@ -1299,7 +1298,7 @@ NET_HANDLE(TE_CSQC_SERVERINFO, bool isNew)
 
        string msg = "";
        msg = strcat(msg, ver);
-       msg = strcat(msg, "^8\n\n", _("match type is "), " ^1", gamemode_name, "^8\n");
+       msg = strcat(msg, "^8\n\n", _("match type is "), " ^1", MapInfo_Type_ToText(gametype), "^8\n");
        if(modifications != "")
                msg = strcat(msg, "^8\n", _("active modifications:"), " ^3", modifications, "^8\n");
        if (cache_mutatormsg != "")
index cadb523cf1af33c0f60b834014b11da8377543ef..a1c4c700377adfcdae13adb7a1764da8f3d2cb57 100644 (file)
@@ -1040,7 +1040,6 @@ void SendWelcomemessage(entity this, bool force_centerprint)
        WriteByte(MSG_ONE, force_centerprint);
        WriteString(MSG_ONE, autocvar_hostname);
        WriteString(MSG_ONE, GetClientVersionMessage(this));
-       WriteString(MSG_ONE, gamemode_name);
 
        MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
        string modifications = M_ARGV(0, string);
@@ -1080,6 +1079,17 @@ void SendWelcomemessage(entity this, bool force_centerprint)
        WriteString(MSG_ONE, strreplace("\\n", "\n", autocvar_sv_motd));
 }
 
+void SendWelcomemessage_onConnection_think(entity this)
+{
+       SendWelcomemessage(this, false);
+}
+
+void SendWelcomemessage_onConnection(entity this)
+{
+       // give the client time to sent its version
+       defer(this, 0.5, SendWelcomemessage_onConnection_think);
+}
+
 /**
 =============
 ClientConnect
@@ -1169,7 +1179,7 @@ void ClientConnect(entity this)
        if (IS_REAL_CLIENT(this))
        {
                if (!autocvar_g_campaign)
-                       SendWelcomemessage(this, false);
+                       SendWelcomemessage_onConnection(this);
                sv_notice_join(this);
        }