From: terencehill <piuntn@gmail.com>
Date: Tue, 26 Apr 2022 21:47:06 +0000 (+0200)
Subject: Fix Welcome message "popping up multiple times in the middle of a match"
X-Git-Tag: xonotic-v0.8.5~51
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dad0572b6112ed622fd0c19850e9036867f8833b;p=xonotic%2Fxonotic-data.pk3dir.git

Fix Welcome message "popping up multiple times in the middle of a match"
---

diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc
index 950b1114e..b6244ee24 100644
--- a/qcsrc/server/scores.qc
+++ b/qcsrc/server/scores.qc
@@ -210,12 +210,11 @@ bool ScoreInfo_SendEntity(entity this, entity to, int sf)
 	}
 	// prevent sending the welcome message again when score types are sent again because the scoring system has changed
 	// it can happen in some game modes like Race when the qualyfing session ends and the race starts
-	// NOTE: CS(this) is not initialized yet when a local client connects to a local dedicated server
-	bool welcome_msg_too = (!CS(this) || time < CS(this).jointime + 5);
+	bool welcome_msg_too = (!CS(to) || time < CS(to).jointime + 5);
 	WriteByte(MSG_ENTITY, welcome_msg_too);
 	// welcome message is sent here because it needs to know the gametype
 	if (welcome_msg_too)
-		SendWelcomemessage_msg_type(this, false, MSG_ENTITY);
+		SendWelcomemessage_msg_type(to, false, MSG_ENTITY);
 	return true;
 }