]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Don't send the welcome message twice on connection. This change also fixes the welcom...
authorterencehill <piuntn@gmail.com>
Tue, 5 Apr 2022 14:11:40 +0000 (16:11 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 5 Apr 2022 14:11:40 +0000 (16:11 +0200)
qcsrc/client/main.qc
qcsrc/server/scores.qc

index b577140c4ee775a2054093e9c7909e7c6f8c4e2e..8165f4cead3f76540654bef10b0eaf3bc713885c 100644 (file)
@@ -1053,7 +1053,9 @@ NET_HANDLE(ENT_CLIENT_SCORES_INFO, bool isnew)
                strcpy(teamscores_label(i), ReadString());
                teamscores_flags(i) = ReadByte();
        }
-       net_handle_ServerWelcome();
+       bool welcome_msg_too = ReadByte();
+       if (welcome_msg_too)
+               net_handle_ServerWelcome();
        return = true;
        Scoreboard_InitScores();
        Gamemode_Init();
index 18f5cacc68fb427d3346b98aa98fb1a6f7b701e7..38fd7f40e16ee2a2c76d3db8bd476f08fcc7ed55 100644 (file)
@@ -194,6 +194,7 @@ void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
        }
 }
 
+.bool welcome_msg_already_sent_on_connection;
 bool ScoreInfo_SendEntity(entity this, entity to, int sf)
 {
        float i;
@@ -208,10 +209,14 @@ bool ScoreInfo_SendEntity(entity this, entity to, int sf)
                WriteString(MSG_ENTITY, teamscores_label(i));
                WriteByte(MSG_ENTITY, teamscores_flags(i));
        }
-       // for some reason ScoreInfo_SendEntity is called twice on client connection
-       // FIXME send the welcome message only once
+       bool welcome_msg_too = (!to.welcome_msg_already_sent_on_connection);
+       WriteByte(MSG_ENTITY, welcome_msg_too);
        // welcome message is sent here because it needs to know the gametype
-       SendWelcomemessage_msg_type(this, false, MSG_ENTITY);
+       if (welcome_msg_too)
+       {
+               SendWelcomemessage_msg_type(this, false, MSG_ENTITY);
+               to.welcome_msg_already_sent_on_connection = true;
+       }
        return true;
 }