4 #include "../dpdefs/progsdefs.qh"
5 #include "../dpdefs/dpextensions.qh"
6 #include "../common/constants.qh"
7 #include "../common/teams.qh"
8 #include "../common/util.qh"
9 #include "autocvars.qh"
10 #include "constants.qh"
12 #include "mutators/mutators_include.qh"
13 #include "../common/mapinfo.qh"
14 #include "../common/playerstats.qh"
19 entity teamscorekeepers[16];
20 string scores_label[MAX_SCORE];
21 float scores_flags[MAX_SCORE];
22 string teamscores_label[MAX_TEAMSCORE];
23 float teamscores_flags[MAX_TEAMSCORE];
24 float teamscores_entities_count;
25 var .float scores_primary;
26 var .float teamscores_primary;
27 float scores_flags_primary;
28 float teamscores_flags_primary;
30 vector ScoreField_Compare(entity t1, entity t2, .float field, float fieldflags, vector previous, float strict) // returns: cmp value, best prio
32 if(!strict && !(fieldflags & SFL_SORT_PRIO_MASK)) // column does not sort
34 if((fieldflags & SFL_SORT_PRIO_MASK) < previous.y)
36 if(t1.field == t2.field)
39 previous_y = fieldflags & SFL_SORT_PRIO_MASK;
41 if(fieldflags & SFL_ZERO_IS_WORST)
48 else if(t2.field == 0)
55 if(fieldflags & SFL_LOWER_IS_BETTER)
56 previous_x = (t2.field - t1.field);
58 previous_x = (t1.field - t2.field);
67 float TeamScore_SendEntity(entity to, float sendflags)
69 float i, p, longflags;
71 WriteByte(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
72 WriteByte(MSG_ENTITY, self.team - 1);
75 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
76 if(self.(teamscores[i]) > 127 || self.(teamscores[i]) <= -128)
79 #if MAX_TEAMSCORE <= 8
80 WriteByte(MSG_ENTITY, sendflags);
81 WriteByte(MSG_ENTITY, longflags);
83 WriteShort(MSG_ENTITY, sendflags);
84 WriteShort(MSG_ENTITY, longflags);
86 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
90 WriteInt24_t(MSG_ENTITY, self.(teamscores[i]));
92 WriteChar(MSG_ENTITY, self.(teamscores[i]));
98 void TeamScore_Spawn(float t, string name)
102 ts.classname = "csqc_score_team";
103 ts.netname = name; // not used yet, FIXME
105 Net_LinkEntity(ts, false, 0, TeamScore_SendEntity);
106 teamscorekeepers[t - 1] = ts;
107 ++teamscores_entities_count;
108 PlayerStats_GameReport_AddTeam(t);
111 float TeamScore_AddToTeam(float t, float scorefield, float score)
118 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
119 if(t <= 0 || t >= 16)
123 error("Adding score to invalid team!");
125 s = teamscorekeepers[t - 1];
130 error("Adding score to unknown team!");
133 if(teamscores_label[scorefield] != "")
134 s.SendFlags |= pow(2, scorefield);
135 return (s.(teamscores[scorefield]) += score);
138 float TeamScore_Add(entity player, float scorefield, float score)
140 return TeamScore_AddToTeam(player.team, scorefield, score);
143 float TeamScore_Compare(entity t1, entity t2, float strict)
145 if(!t1 || !t2) return (!t2) - !t1;
147 vector result = '0 0 0';
149 for(i = 0; i < MAX_TEAMSCORE; ++i)
153 result = ScoreField_Compare(t1, t2, f, teamscores_flags[i], result, strict);
156 if (result_x == 0 && strict)
157 result_x = t1.team - t2.team;
163 * the scoreinfo entity
166 void ScoreInfo_SetLabel_PlayerScore(float i, string label, float scoreflags)
168 scores_label[i] = label;
169 scores_flags[i] = scoreflags;
170 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
172 scores_primary = scores[i];
173 scores_flags_primary = scoreflags;
177 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
178 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
182 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
184 teamscores_label[i] = label;
185 teamscores_flags[i] = scoreflags;
186 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
188 teamscores_primary = teamscores[i];
189 teamscores_flags_primary = scoreflags;
193 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
194 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
198 float ScoreInfo_SendEntity(entity to, float sf)
201 WriteByte(MSG_ENTITY, ENT_CLIENT_SCORES_INFO);
202 WriteInt24_t(MSG_ENTITY, MapInfo_LoadedGametype);
203 for(i = 0; i < MAX_SCORE; ++i)
205 WriteString(MSG_ENTITY, scores_label[i]);
206 WriteByte(MSG_ENTITY, scores_flags[i]);
208 for(i = 0; i < MAX_TEAMSCORE; ++i)
210 WriteString(MSG_ENTITY, teamscores_label[i]);
211 WriteByte(MSG_ENTITY, teamscores_flags[i]);
216 void ScoreInfo_Init(float teams)
218 if(scores_initialized)
220 scores_initialized.SendFlags |= 1; // force a resend
224 scores_initialized = spawn();
225 scores_initialized.classname = "ent_client_scoreinfo";
226 Net_LinkEntity(scores_initialized, false, 0, ScoreInfo_SendEntity);
229 TeamScore_Spawn(NUM_TEAM_1, "Red");
231 TeamScore_Spawn(NUM_TEAM_2, "Blue");
233 TeamScore_Spawn(NUM_TEAM_3, "Yellow");
235 TeamScore_Spawn(NUM_TEAM_4, "Pink");
239 * per-player score entities
242 float PlayerScore_SendEntity(entity to, float sendflags)
244 float i, p, longflags;
246 WriteByte(MSG_ENTITY, ENT_CLIENT_SCORES);
247 WriteByte(MSG_ENTITY, num_for_edict(self.owner));
250 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
251 if(self.(scores[i]) > 127 || self.(scores[i]) <= -128)
255 WriteByte(MSG_ENTITY, sendflags);
256 WriteByte(MSG_ENTITY, longflags);
258 WriteShort(MSG_ENTITY, sendflags);
259 WriteShort(MSG_ENTITY, longflags);
261 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
265 WriteInt24_t(MSG_ENTITY, self.(scores[i]));
267 WriteChar(MSG_ENTITY, self.(scores[i]));
273 float PlayerScore_Clear(entity player)
278 if(teamscores_entities_count)
281 if(MUTATOR_CALLHOOK(ForbidPlayerScore_Clear)) return 0;
283 sk = player.scorekeeper;
284 for(i = 0; i < MAX_SCORE; ++i)
286 if(sk.(scores[i]) != 0)
287 if(scores_label[i] != "")
288 sk.SendFlags |= pow(2, i);
295 void Score_ClearAll()
299 FOR_EACH_CLIENTSLOT(p)
304 for(i = 0; i < MAX_SCORE; ++i)
306 if(sk.(scores[i]) != 0)
307 if(scores_label[i] != "")
308 sk.SendFlags |= pow(2, i);
312 for(t = 0; t < 16; ++t)
314 sk = teamscorekeepers[t];
317 for(i = 0; i < MAX_TEAMSCORE; ++i)
319 if(sk.(teamscores[i]) != 0)
320 if(teamscores_label[i] != "")
321 sk.SendFlags |= pow(2, i);
322 sk.(teamscores[i]) = 0;
327 void PlayerScore_Attach(entity player)
330 if(player.scorekeeper)
331 error("player already has a scorekeeper");
334 Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
335 player.scorekeeper = sk;
338 void PlayerScore_Detach(entity player)
340 if(!player.scorekeeper)
341 error("player has no scorekeeper");
342 remove(player.scorekeeper);
343 player.scorekeeper = world;
346 float PlayerScore_Add(entity player, float scorefield, float score)
351 if(!(g_lms && scorefield == SP_LMS_RANK)) // allow writing to this field in intermission as it is needed for newly joining players
354 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
355 s = player.scorekeeper;
360 backtrace("Adding score to unknown player!");
364 if(scores_label[scorefield] != "")
365 s.SendFlags |= pow(2, scorefield);
367 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label[scorefield]), score);
368 return (s.(scores[scorefield]) += score);
371 float PlayerTeamScore_Add(entity player, float pscorefield, float tscorefield, float score)
374 r = PlayerScore_Add(player, pscorefield, score);
375 if(teamscores_entities_count) // only for teamplay
376 r = TeamScore_Add(player, tscorefield, score);
380 float PlayerScore_Compare(entity t1, entity t2, float strict)
382 if(!t1 || !t2) return (!t2) - !t1;
384 vector result = '0 0 0';
386 for(i = 0; i < MAX_SCORE; ++i)
390 result = ScoreField_Compare(t1, t2, f, scores_flags[i], result, strict);
393 if (result_x == 0 && strict)
394 result_x = num_for_edict(t1.owner) - num_for_edict(t2.owner);
399 void WinningConditionHelper()
405 entity winnerscorekeeper;
406 entity secondscorekeeper;
410 // gametype:P<pure>:S<slots>::plabel,plabel:tlabel,tlabel:teamid:tscore,tscore:teamid:tscore,tscore
411 // score labels always start with a symbol or with lower case
412 // so to match pure, match for :P0:
413 // to match full, match for :S0:
415 fullstatus = autocvar_g_full_getstatus_responses;
418 s = strcat(s, ":", autocvar_g_xonoticversion);
419 s = strcat(s, ":P", ftos(cvar_purechanges_count));
420 s = strcat(s, ":S", ftos(nJoinAllowed(world)));
421 s = strcat(s, ":F", ftos(serverflags));
422 s = strcat(s, ":M", modname);
423 s = strcat(s, "::", GetPlayerScoreString(world, (fullstatus ? 1 : 2)));
425 if(teamscores_entities_count)
429 s = strcat(s, ":", GetTeamScoreString(0, 1));
430 for(t = 0; t < 16; ++t)
431 if(teamscorekeepers[t])
432 s = strcat(s, ":", ftos(t+1), ":", GetTeamScoreString(t+1, 1));
434 WinningConditionHelper_winnerteam = -1;
435 WinningConditionHelper_secondteam = -1;
436 winnerscorekeeper = world;
437 secondscorekeeper = world;
438 for(t = 0; t < 16; ++t)
440 sk = teamscorekeepers[t];
441 c = TeamScore_Compare(winnerscorekeeper, sk, 1);
444 WinningConditionHelper_secondteam = WinningConditionHelper_winnerteam;
445 WinningConditionHelper_winnerteam = t + 1;
446 secondscorekeeper = winnerscorekeeper;
447 winnerscorekeeper = sk;
451 c = TeamScore_Compare(secondscorekeeper, sk, 1);
454 WinningConditionHelper_secondteam = t + 1;
455 secondscorekeeper = sk;
460 WinningConditionHelper_equality = (TeamScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
461 if(WinningConditionHelper_equality)
462 WinningConditionHelper_winnerteam = WinningConditionHelper_secondteam = -1;
464 WinningConditionHelper_topscore = winnerscorekeeper.teamscores_primary;
465 WinningConditionHelper_secondscore = secondscorekeeper.teamscores_primary;
466 WinningConditionHelper_lowerisbetter = (teamscores_flags_primary & SFL_LOWER_IS_BETTER);
467 WinningConditionHelper_zeroisworst = (teamscores_flags_primary & SFL_ZERO_IS_WORST);
469 WinningConditionHelper_winner = world; // not supported in teamplay
470 WinningConditionHelper_second = world; // not supported in teamplay
474 WinningConditionHelper_winner = world;
475 WinningConditionHelper_second = world;
476 winnerscorekeeper = world;
477 secondscorekeeper = world;
481 c = PlayerScore_Compare(winnerscorekeeper, sk, 1);
484 WinningConditionHelper_second = WinningConditionHelper_winner;
485 WinningConditionHelper_winner = p;
486 secondscorekeeper = winnerscorekeeper;
487 winnerscorekeeper = sk;
491 c = PlayerScore_Compare(secondscorekeeper, sk, 1);
494 WinningConditionHelper_second = p;
495 secondscorekeeper = sk;
500 WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
501 if(WinningConditionHelper_equality)
502 WinningConditionHelper_winner = WinningConditionHelper_second = world;
504 WinningConditionHelper_topscore = winnerscorekeeper.scores_primary;
505 WinningConditionHelper_secondscore = secondscorekeeper.scores_primary;
506 WinningConditionHelper_lowerisbetter = (scores_flags_primary & SFL_LOWER_IS_BETTER);
507 WinningConditionHelper_zeroisworst = (scores_flags_primary & SFL_ZERO_IS_WORST);
509 WinningConditionHelper_winnerteam = -1; // no teamplay
510 WinningConditionHelper_secondteam = -1; // no teamplay
513 if(WinningConditionHelper_topscore == 0)
515 if(scores_flags_primary & SFL_ZERO_IS_WORST)
517 if(WinningConditionHelper_lowerisbetter)
518 WinningConditionHelper_topscore = 999999999;
520 WinningConditionHelper_topscore = -999999999;
522 WinningConditionHelper_equality = 0;
525 if(WinningConditionHelper_secondscore == 0)
527 if(scores_flags_primary & SFL_ZERO_IS_WORST)
529 if(WinningConditionHelper_lowerisbetter)
530 WinningConditionHelper_secondscore = 999999999;
532 WinningConditionHelper_secondscore = -999999999;
537 strunzone(worldstatus);
538 worldstatus = strzone(s);
544 s = GetPlayerScoreString(p, 1);
545 if(IS_REAL_CLIENT(p))
546 s = strcat(s, ":human");
548 s = strcat(s, ":bot");
549 if(!IS_PLAYER(p) && p.caplayer != 1 && !g_lms)
550 s = strcat(s, ":spectator");
554 if(IS_PLAYER(p) || p.caplayer == 1 || g_lms)
555 s = GetPlayerScoreString(p, 2);
561 strunzone(p.clientstatus);
562 p.clientstatus = strzone(s);
566 string GetScoreLogLabel(string label, float fl)
568 if(fl & SFL_LOWER_IS_BETTER)
569 label = strcat(label, "<");
570 if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
571 label = strcat(label, "!!");
572 else if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
573 label = strcat(label, "!");
577 string GetPlayerScoreString(entity pl, float shortString)
588 for(i = 0; i < MAX_SCORE; ++i)
589 if((scores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
593 out = strcat(out, GetScoreLogLabel(l, f), ",");
596 for(i = 0; i < MAX_SCORE; ++i)
597 if((scores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
601 out = strcat(out, GetScoreLogLabel(l, f), ",");
604 for(i = 0; i < MAX_SCORE; ++i)
605 if((scores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
606 if((scores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
610 out = strcat(out, GetScoreLogLabel(l, f), ",");
612 out = substring(out, 0, strlen(out) - 1);
614 else if((sk = pl.scorekeeper))
616 for(i = 0; i < MAX_SCORE; ++i)
617 if((scores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
618 out = strcat(out, ftos(sk.(scores[i])), ",");
620 for(i = 0; i < MAX_SCORE; ++i)
621 if((scores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
622 out = strcat(out, ftos(sk.(scores[i])), ",");
624 for(i = 0; i < MAX_SCORE; ++i)
625 if((scores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
626 if((scores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
627 out = strcat(out, ftos(sk.(scores[i])), ",");
628 out = substring(out, 0, strlen(out) - 1);
633 string GetTeamScoreString(float tm, float shortString)
644 for(i = 0; i < MAX_TEAMSCORE; ++i)
645 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
647 f = teamscores_flags[i];
648 l = teamscores_label[i];
649 out = strcat(out, GetScoreLogLabel(l, f), ",");
652 for(i = 0; i < MAX_TEAMSCORE; ++i)
653 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
655 f = teamscores_flags[i];
656 l = teamscores_label[i];
657 out = strcat(out, GetScoreLogLabel(l, f), ",");
660 for(i = 0; i < MAX_TEAMSCORE; ++i)
661 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
662 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
664 f = teamscores_flags[i];
665 l = teamscores_label[i];
666 out = strcat(out, GetScoreLogLabel(l, f), ",");
668 out = substring(out, 0, strlen(out) - 1);
670 else if((sk = teamscorekeepers[tm - 1]))
672 for(i = 0; i < MAX_TEAMSCORE; ++i)
673 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
674 out = strcat(out, ftos(sk.(teamscores[i])), ",");
676 for(i = 0; i < MAX_TEAMSCORE; ++i)
677 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
678 out = strcat(out, ftos(sk.(teamscores[i])), ",");
680 for(i = 0; i < MAX_TEAMSCORE; ++i)
681 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
682 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
683 out = strcat(out, ftos(sk.(teamscores[i])), ",");
684 out = substring(out, 0, strlen(out) - 1);
689 float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict)
691 if(teams && teamscores_entities_count)
693 if(p1.team != p2.team)
697 t1 = teamscorekeepers[p1.team - 1];
698 t2 = teamscorekeepers[p2.team - 1];
699 r = TeamScore_Compare(t1, t2, ((teams >= 0) ? 1 : strict));
706 return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
709 entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
711 entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
719 FOR_EACH_CLIENT(p) if(p.scorekeeper)
722 if(p.frags == FRAGS_SPECTATOR)
728 // Now plist points to the whole list.
730 pfirst = plast = world;
735 pprev = pbestprev = world;
737 for(p = plist; (pprev = p), (p = p.chain); )
739 if(PlayerTeamScore_Compare(p, pbest, teams, strict) > 0)
746 // remove pbest out of the chain
747 if(pbestprev == world)
750 pbestprev.chain = pbest.chain;
754 if(!plast || PlayerTeamScore_Compare(plast, pbest, teams, 0))
769 float TeamScore_GetCompareValue(float t)
774 if(t <= 0 || t >= 16)
778 error("Reading score of invalid team!");
781 sk = teamscorekeepers[t - 1];
784 s = sk.teamscores_primary;
785 if(teamscores_flags_primary & SFL_ZERO_IS_WORST)
788 if(teamscores_flags_primary & SFL_LOWER_IS_BETTER)
793 const float NAMEWIDTH = 22;
794 const float SCORESWIDTH = 58;
795 // TODO put this somewhere in common?
796 string Score_NicePrint_ItemColor(float vflags)
798 if(vflags & SFL_SORT_PRIO_PRIMARY)
800 else if(vflags & SFL_SORT_PRIO_SECONDARY)
806 void Score_NicePrint_Team(entity to, float t, float w)
814 sk = teamscorekeepers[t - 1];
817 s = strcat(s, Team_ColoredFullName(t));
818 for(i = 0; i < MAX_TEAMSCORE; ++i)
819 if(teamscores_label[i] != "")
821 fl = teamscores_flags[i];
822 sc = sk.(teamscores[i]);
823 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), ScoreString(fl, sc));
829 s = strcat(s, strpad(max(0, NAMEWIDTH - strlennocol(s)), ""));
831 for(i = 0; i < MAX_SCORE; ++i)
832 if(scores_label[i] != "")
834 fl = scores_flags[i];
835 s2 = scores_label[i];
836 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, substring(s2, 0, w)));
842 void Score_NicePrint_Player(entity to, entity p, float w)
852 s = strcat(s, p.netname);
855 i = strlennocol(s) - NAMEWIDTH;
857 s = substring(s, 0, strlen(s) - i);
860 s = strcat(s, strpad(i, ""));
865 for(i = 0; i < MAX_SCORE; ++i)
866 if(scores_label[i] != "")
868 fl = scores_flags[i];
870 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, ScoreString(fl, sc)));
876 void Score_NicePrint_Spectators(entity to)
878 print_to(to, "Spectators:");
881 void Score_NicePrint_Spectator(entity to, entity p)
883 print_to(to, strcat(" ", p.netname));
886 .float score_dummyfield;
887 void Score_NicePrint(entity to)
894 for(i = 0; i < MAX_SCORE; ++i)
895 if(scores_label[i] != "")
897 w = bound(6, floor(SCORESWIDTH / t - 1), 9);
899 p = PlayerScore_Sort(score_dummyfield, 1, 1, 0);
902 if(!teamscores_entities_count)
903 Score_NicePrint_Team(to, t, w);
906 if(teamscores_entities_count)
908 Score_NicePrint_Team(to, p.team, w);
909 Score_NicePrint_Player(to, p, w);
919 Score_NicePrint_Spectators(to);
920 Score_NicePrint_Spectator(to, p);
925 void PlayerScore_PlayerStats(entity p)
931 for(i = 0; i < MAX_SCORE; ++i)
932 if(s.(scores[i]) != 0)
933 if(scores_label[i] != "")
934 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_SCOREBOARD, scores_label[i]), s.(scores[i]));
937 void PlayerScore_TeamStats(void)
941 for(t = 0; t < 16; ++t)
943 sk = teamscorekeepers[t];
946 for(i = 0; i < MAX_TEAMSCORE; ++i)
947 if(sk.(teamscores[i]) != 0)
948 if(teamscores_label[i] != "")
949 // the +1 is important here!
950 PS_GR_T_ADDVAL(t+1, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label[i]), sk.(teamscores[i]));