From a13744a4c551505e4e69aa4d2f559d814a5fa016 Mon Sep 17 00:00:00 2001 From: TimePath Date: Fri, 11 Dec 2015 20:59:30 +1100 Subject: [PATCH] Scoreboard: remove team 0 Closes #1584 and #1597 --- qcsrc/client/main.qc | 3 ++- qcsrc/client/scoreboard.qc | 2 +- qcsrc/common/ent_cs.qh | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index c6529a070..576b2485c 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 06c7363af..6ef89bf4d 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 8122ccdc0..e8d568af5 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 */ -- 2.39.2