From 47d309fde9bbfd7b3cfdcdb0f98a48b94382907c Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 5 Apr 2022 16:11:40 +0200 Subject: [PATCH] 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 --- qcsrc/client/main.qc | 4 +++- qcsrc/server/scores.qc | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) 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; } -- 2.39.2