From: terencehill Date: Tue, 5 Apr 2022 14:11:40 +0000 (+0200) Subject: Don't send the welcome message twice on connection. This change also fixes the welcom... X-Git-Tag: xonotic-v0.8.5~105 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=47d309fde9bbfd7b3cfdcdb0f98a48b94382907c;p=xonotic%2Fxonotic-data.pk3dir.git Don't send the welcome message twice on connection. This change also fixes the welcome message being displayed in Race when the qualifying session is over and the race starts --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index b577140c4..8165f4cea 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -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(); diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 18f5cacc6..38fd7f40e 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -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; }