From: terencehill <piuntn@gmail.com>
Date: Tue, 28 Jun 2011 14:24:32 +0000 (+0200)
Subject: Since killindicator is shared use CPID_TEAMCHANGE when suiciding too, and be sure... 
X-Git-Tag: xonotic-v0.5.0~171
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ce7b10e54002a14e42b451509dbe03a02d0bbfa4;p=xonotic%2Fxonotic-data.pk3dir.git

Since killindicator is shared use CPID_TEAMCHANGE when suiciding too, and be sure that killindicator.cnt is > 0 otherwise calling a countdown when another one is already started the countdown number may be displayed as %d
---

diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh
index 9035a974f..ffb0d0faa 100644
--- a/qcsrc/common/constants.qh
+++ b/qcsrc/common/constants.qh
@@ -614,7 +614,7 @@ float MAX_SHOT_DISTANCE = 32768;
 
 //centerprint ID list
 float CPID_TEAMCHANGE = 1;
-float CPID_KILL = 2;
+
 float CPID_MINSTA_FINDAMMO = 3;
 float CPID_NIX_WPNCHANGE = 4;
 float CPID_DISCONNECT_IDLING = 5;
diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc
index a3a951b88..38a529866 100644
--- a/qcsrc/server/cl_client.qc
+++ b/qcsrc/server/cl_client.qc
@@ -1392,24 +1392,28 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
 		{
 			self.killindicator.colormod = '0 0 0';
 			if(clienttype(self) == CLIENTTYPE_REAL)
-				Send_CSQC_Centerprint_Generic(self, CPID_KILL, "^1Suicide in %d seconds", 1, self.killindicator.cnt);
+			if(self.killindicator.cnt > 0)
+				Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "^1Suicide in %d seconds", 1, self.killindicator.cnt);
 		}
 		else if(targetteam == -1) // auto
 		{
 			self.killindicator.colormod = '0 1 0';
 			if(clienttype(self) == CLIENTTYPE_REAL)
+			if(self.killindicator.cnt > 0)
 				Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "Changing team in %d seconds", 1, self.killindicator.cnt);
 		}
 		else if(targetteam == -2) // spectate
 		{
 			self.killindicator.colormod = '0.5 0.5 0.5';
 			if(clienttype(self) == CLIENTTYPE_REAL)
+			if(self.killindicator.cnt > 0)
 				Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "Spectating in %d seconds", 1, self.killindicator.cnt);
 		}
 		else
 		{
 			self.killindicator.colormod = TeamColor(targetteam);
 			if(clienttype(self) == CLIENTTYPE_REAL)
+			if(self.killindicator.cnt > 0)
 				Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, strcat("Changing to ", ColoredTeamName(targetteam), " in %d seconds"), 1, self.killindicator.cnt);
 		}
 	}