From: TimePath <andrew.hardaker1995@gmail.com>
Date: Fri, 11 Dec 2015 09:59:30 +0000 (+1100)
Subject: Scoreboard: remove team 0
X-Git-Tag: xonotic-v0.8.2~1509
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a13744a4c551505e4e69aa4d2f559d814a5fa016;p=xonotic%2Fxonotic-data.pk3dir.git

Scoreboard: remove team 0

Closes #1584 and #1597
---

diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc
index c6529a070e..576b2485c5 100644
--- a/qcsrc/client/main.qc
+++ b/qcsrc/client/main.qc
@@ -271,7 +271,8 @@ void Playerchecker_Think()
 				e.ping_packetloss = 0;
 				e.ping_movementloss = 0;
 				//e.gotscores = 0; // we might already have the scores...
-				SetTeam(e, entcs_GetTeam(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
+				int t = entcs_GetScoreTeam(i);
+				if (t) SetTeam(e, t); // will not hurt; later updates come with HUD_UpdatePlayerTeams
 				RegisterPlayer(e);
 				HUD_UpdatePlayerPos(e);
 			}
diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc
index 06c7363afe..6ef89bf4d0 100644
--- a/qcsrc/client/scoreboard.qc
+++ b/qcsrc/client/scoreboard.qc
@@ -109,7 +109,7 @@ void HUD_UpdatePlayerTeams()
 	for(pl = players.sort_next; pl; pl = pl.sort_next)
 	{
 		num += 1;
-		Team = entcs_GetTeam(pl.sv_entnum);
+		Team = entcs_GetScoreTeam(pl.sv_entnum);
 		if(SetTeam(pl, Team))
 		{
 			tmp = pl.sort_prev;
diff --git a/qcsrc/common/ent_cs.qh b/qcsrc/common/ent_cs.qh
index 8122ccdc0e..e8d568af5e 100644
--- a/qcsrc/common/ent_cs.qh
+++ b/qcsrc/common/ent_cs.qh
@@ -82,6 +82,16 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
 		return entcs_IsSpectating(i) ? NUM_SPECTATOR : entcs_GetTeamColor(i);
 	}
 
+	/**
+	 * Same as `entcs_GetTeam`, but returns -1 for no team
+	 */
+	int entcs_GetScoreTeam(int i)
+	{
+		int t = entcs_GetTeam(i);
+		if (!t) t = -1;
+		return t;
+	}
+
 	/**
 	* @param i zero indexed player
 	*/