3 #include "command/common.qh"
4 #include "mutators/_mod.qh"
5 #include "../common/playerstats.qh"
6 #include "../common/teams.qh"
9 entity teamscorekeepers[16];
10 float teamscores_entities_count;
11 var .float scores_primary;
12 var .float teamscores_primary;
13 float scores_flags_primary;
14 float teamscores_flags_primary;
16 vector ScoreField_Compare(entity t1, entity t2, .float field, float fieldflags, vector previous, float strict) // returns: cmp value, best prio
18 if(!strict && !(fieldflags & SFL_SORT_PRIO_MASK)) // column does not sort
20 if((fieldflags & SFL_SORT_PRIO_MASK) < previous.y)
22 if (t1.(field) == t2.(field))
25 previous.y = fieldflags & SFL_SORT_PRIO_MASK;
27 if(fieldflags & SFL_ZERO_IS_WORST)
34 else if (t2.(field) == 0)
41 if (fieldflags & SFL_LOWER_IS_BETTER)
42 previous.x = (t2.(field) - t1.(field));
44 previous.x = (t1.(field) - t2.(field));
53 bool TeamScore_SendEntity(entity this, entity to, float sendflags)
55 float i, p, longflags;
57 WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
58 int t = this.team - 1;
59 assert(t, eprint(this));
60 WriteByte(MSG_ENTITY, t);
63 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
64 if(this.(teamscores(i)) > 127 || this.(teamscores(i)) <= -128)
67 #if MAX_TEAMSCORE <= 8
68 WriteByte(MSG_ENTITY, sendflags);
69 WriteByte(MSG_ENTITY, longflags);
71 WriteShort(MSG_ENTITY, sendflags);
72 WriteShort(MSG_ENTITY, longflags);
74 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
78 WriteInt24_t(MSG_ENTITY, this.(teamscores(i)));
80 WriteChar(MSG_ENTITY, this.(teamscores(i)));
86 void TeamScore_Spawn(float t, string name)
88 entity ts = new_pure(csqc_score_team);
89 ts.netname = name; // not used yet, FIXME
91 Net_LinkEntity(ts, false, 0, TeamScore_SendEntity);
92 teamscorekeepers[t - 1] = ts;
93 ++teamscores_entities_count;
94 PlayerStats_GameReport_AddTeam(t);
97 float TeamScore_AddToTeam(float t, float scorefield, float score)
104 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
105 if(t <= 0 || t >= 16)
109 error("Adding score to invalid team!");
111 s = teamscorekeepers[t - 1];
116 error("Adding score to unknown team!");
119 if(teamscores_label(scorefield) != "")
120 s.SendFlags |= pow(2, scorefield);
121 return (s.(teamscores(scorefield)) += score);
124 float TeamScore_Add(entity player, float scorefield, float score)
126 return TeamScore_AddToTeam(player.team, scorefield, score);
129 float TeamScore_Compare(entity t1, entity t2, float strict)
131 if(!t1 || !t2) return (!t2) - !t1;
133 vector result = '0 0 0';
135 for(i = 0; i < MAX_TEAMSCORE; ++i)
139 result = ScoreField_Compare(t1, t2, f, teamscores_flags(i), result, strict);
142 if (result.x == 0 && strict)
143 result.x = t1.team - t2.team;
149 * the scoreinfo entity
152 void ScoreInfo_SetLabel_PlayerScore(PlayerScoreField i, string label, float scoreflags)
154 scores_label(i) = label;
155 scores_flags(i) = scoreflags;
156 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
158 scores_primary = scores(i);
159 scores_flags_primary = scoreflags;
163 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
164 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
168 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
170 teamscores_label(i) = label;
171 teamscores_flags(i) = scoreflags;
172 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
174 teamscores_primary = teamscores(i);
175 teamscores_flags_primary = scoreflags;
179 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
180 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
184 bool ScoreInfo_SendEntity(entity this, entity to, int sf)
187 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES_INFO);
188 WriteRegistered(Gametypes, MSG_ENTITY, MapInfo_LoadedGametype);
189 FOREACH(Scores, true, {
190 WriteString(MSG_ENTITY, scores_label(it));
191 WriteByte(MSG_ENTITY, scores_flags(it));
193 for(i = 0; i < MAX_TEAMSCORE; ++i)
195 WriteString(MSG_ENTITY, teamscores_label(i));
196 WriteByte(MSG_ENTITY, teamscores_flags(i));
201 void ScoreInfo_Init(int teams)
203 if(scores_initialized)
205 scores_initialized.SendFlags |= 1; // force a resend
209 scores_initialized = new_pure(ent_client_scoreinfo);
210 Net_LinkEntity(scores_initialized, false, 0, ScoreInfo_SendEntity);
213 TeamScore_Spawn(NUM_TEAM_1, "Red");
215 TeamScore_Spawn(NUM_TEAM_2, "Blue");
217 TeamScore_Spawn(NUM_TEAM_3, "Yellow");
219 TeamScore_Spawn(NUM_TEAM_4, "Pink");
223 * per-player score entities
226 bool PlayerScore_SendEntity(entity this, entity to, float sendflags)
228 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES);
229 WriteByte(MSG_ENTITY, etof(this.owner));
232 FOREACH(Scores, true, {
233 int p = 1 << (i % 16);
234 if (this.(scores(it)) > 127 || this.(scores(it)) <= -128)
238 WriteShort(MSG_ENTITY, sendflags);
239 WriteShort(MSG_ENTITY, longflags);
240 FOREACH(Scores, true, {
241 int p = 1 << (i % 16);
245 WriteInt24_t(MSG_ENTITY, this.(scores(it)));
247 WriteChar(MSG_ENTITY, this.(scores(it)));
254 float PlayerScore_Clear(entity player)
258 if(teamscores_entities_count)
261 if(MUTATOR_CALLHOOK(ForbidPlayerScore_Clear)) return 0;
263 sk = player.scorekeeper;
264 FOREACH(Scores, true, {
265 if(sk.(scores(it)) != 0)
266 if(scores_label(it) != "")
267 sk.SendFlags |= pow(2, i % 16);
274 void Score_ClearAll()
278 FOREACH_CLIENTSLOT(true, {
281 FOREACH(Scores, true, {
282 if(sk.(scores(it)) != 0)
283 if(scores_label(it) != "")
284 sk.SendFlags |= pow(2, i % 16);
288 for(t = 0; t < 16; ++t)
290 sk = teamscorekeepers[t];
293 for(int j = 0; j < MAX_TEAMSCORE; ++j)
295 if(sk.(teamscores(j)) != 0)
296 if(teamscores_label(j) != "")
297 sk.SendFlags |= pow(2, j);
298 sk.(teamscores(j)) = 0;
303 void PlayerScore_Attach(entity player)
305 if(player.scorekeeper)
306 error("player already has a scorekeeper");
307 entity sk = new_pure(scorekeeper);
309 Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
310 player.scorekeeper = sk;
313 void PlayerScore_Detach(entity player)
315 if(!player.scorekeeper)
316 error("player has no scorekeeper");
317 delete(player.scorekeeper);
318 player.scorekeeper = NULL;
321 float PlayerScore_Add(entity player, PlayerScoreField scorefield, float score)
323 bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player);
324 score = M_ARGV(1, float);
327 if(!mutator_returnvalue)
330 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
331 entity s = player.scorekeeper;
336 LOG_WARN("Adding score to unknown player!");
340 if(scores_label(scorefield) != "")
341 s.SendFlags |= pow(2, scorefield.m_id % 16);
343 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label(scorefield)), score);
344 return (s.(scores(scorefield)) += score);
347 float PlayerTeamScore_Add(entity player, PlayerScoreField pscorefield, float tscorefield, float score)
350 r = PlayerScore_Add(player, pscorefield, score);
351 if(teamscores_entities_count) // only for teamplay
352 r = TeamScore_Add(player, tscorefield, score);
356 float PlayerScore_Compare(entity t1, entity t2, float strict)
358 if(!t1 || !t2) return (!t2) - !t1;
360 vector result = '0 0 0';
361 FOREACH(Scores, true, {
362 var .float f = scores(it);
363 result = ScoreField_Compare(t1, t2, f, scores_flags(it), result, strict);
366 if (result.x == 0 && strict)
367 result.x = etof(t1.owner) - etof(t2.owner);
372 void WinningConditionHelper(entity this)
377 entity winnerscorekeeper;
378 entity secondscorekeeper;
382 // gametype:P<pure>:S<slots>::plabel,plabel:tlabel,tlabel:teamid:tscore,tscore:teamid:tscore,tscore
383 // score labels always start with a symbol or with lower case
384 // so to match pure, match for :P0:
385 // to match full, match for :S0:
387 fullstatus = autocvar_g_full_getstatus_responses;
390 s = strcat(s, ":", autocvar_g_xonoticversion);
391 s = strcat(s, ":P", ftos(cvar_purechanges_count));
392 s = strcat(s, ":S", ftos(nJoinAllowed(this, NULL)));
393 s = strcat(s, ":F", ftos(serverflags));
394 s = strcat(s, ":M", modname);
395 s = strcat(s, "::", GetPlayerScoreString(NULL, (fullstatus ? 1 : 2)));
397 if(teamscores_entities_count)
401 s = strcat(s, ":", GetTeamScoreString(0, 1));
402 for(t = 0; t < 16; ++t)
403 if(teamscorekeepers[t])
404 s = strcat(s, ":", ftos(t+1), ":", GetTeamScoreString(t+1, 1));
406 WinningConditionHelper_winnerteam = -1;
407 WinningConditionHelper_secondteam = -1;
408 winnerscorekeeper = NULL;
409 secondscorekeeper = NULL;
410 for(t = 0; t < 16; ++t)
412 sk = teamscorekeepers[t];
413 c = TeamScore_Compare(winnerscorekeeper, sk, 1);
416 WinningConditionHelper_secondteam = WinningConditionHelper_winnerteam;
417 WinningConditionHelper_winnerteam = t + 1;
418 secondscorekeeper = winnerscorekeeper;
419 winnerscorekeeper = sk;
423 c = TeamScore_Compare(secondscorekeeper, sk, 1);
426 WinningConditionHelper_secondteam = t + 1;
427 secondscorekeeper = sk;
432 WinningConditionHelper_equality = (TeamScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
433 if(WinningConditionHelper_equality)
434 WinningConditionHelper_winnerteam = WinningConditionHelper_secondteam = -1;
436 WinningConditionHelper_topscore = winnerscorekeeper.teamscores_primary;
437 WinningConditionHelper_secondscore = secondscorekeeper.teamscores_primary;
438 WinningConditionHelper_lowerisbetter = (teamscores_flags_primary & SFL_LOWER_IS_BETTER);
439 WinningConditionHelper_zeroisworst = (teamscores_flags_primary & SFL_ZERO_IS_WORST);
441 WinningConditionHelper_winner = NULL; // not supported in teamplay
442 WinningConditionHelper_second = NULL; // not supported in teamplay
446 WinningConditionHelper_winner = NULL;
447 WinningConditionHelper_second = NULL;
448 winnerscorekeeper = NULL;
449 secondscorekeeper = NULL;
450 FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
452 c = PlayerScore_Compare(winnerscorekeeper, sk, 1);
455 WinningConditionHelper_second = WinningConditionHelper_winner;
456 WinningConditionHelper_winner = it;
457 secondscorekeeper = winnerscorekeeper;
458 winnerscorekeeper = sk;
462 c = PlayerScore_Compare(secondscorekeeper, sk, 1);
465 WinningConditionHelper_second = it;
466 secondscorekeeper = sk;
471 WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
472 if(WinningConditionHelper_equality)
473 WinningConditionHelper_winner = WinningConditionHelper_second = NULL;
475 WinningConditionHelper_topscore = winnerscorekeeper.scores_primary;
476 WinningConditionHelper_secondscore = secondscorekeeper.scores_primary;
477 WinningConditionHelper_lowerisbetter = (scores_flags_primary & SFL_LOWER_IS_BETTER);
478 WinningConditionHelper_zeroisworst = (scores_flags_primary & SFL_ZERO_IS_WORST);
480 WinningConditionHelper_winnerteam = -1; // no teamplay
481 WinningConditionHelper_secondteam = -1; // no teamplay
484 if(WinningConditionHelper_topscore == 0)
486 if(scores_flags_primary & SFL_ZERO_IS_WORST)
488 if(WinningConditionHelper_lowerisbetter)
489 WinningConditionHelper_topscore = 999999999;
491 WinningConditionHelper_topscore = -999999999;
493 WinningConditionHelper_equality = 0;
496 if(WinningConditionHelper_secondscore == 0)
498 if(scores_flags_primary & SFL_ZERO_IS_WORST)
500 if(WinningConditionHelper_lowerisbetter)
501 WinningConditionHelper_secondscore = 999999999;
503 WinningConditionHelper_secondscore = -999999999;
508 strunzone(worldstatus);
509 worldstatus = strzone(s);
511 FOREACH_CLIENT(true, LAMBDA(
515 s = GetPlayerScoreString(it, 1);
516 s = strcat(s, IS_REAL_CLIENT(it) ? ":human" : ":bot");
517 if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it))
518 s = strcat(s, ":spectator");
522 if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
523 s = GetPlayerScoreString(it, 2);
529 strunzone(it.clientstatus);
530 it.clientstatus = strzone(s);
534 string GetScoreLogLabel(string label, float fl)
536 if(fl & SFL_LOWER_IS_BETTER)
537 label = strcat(label, "<");
538 if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
539 label = strcat(label, "!!");
540 else if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
541 label = strcat(label, "!");
545 string GetPlayerScoreString(entity pl, float shortString)
556 FOREACH(Scores, true, {
557 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
559 f = scores_flags(it);
560 l = scores_label(it);
561 out = strcat(out, GetScoreLogLabel(l, f), ",");
565 FOREACH(Scores, true, {
566 if((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
568 f = scores_flags(it);
569 l = scores_label(it);
570 out = strcat(out, GetScoreLogLabel(l, f), ",");
574 FOREACH(Scores, true, {
575 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
576 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
578 f = scores_flags(it);
579 l = scores_label(it);
580 out = strcat(out, GetScoreLogLabel(l, f), ",");
583 out = substring(out, 0, strlen(out) - 1);
585 else if((sk = pl.scorekeeper))
587 FOREACH(Scores, true, {
588 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
589 out = strcat(out, ftos(sk.(scores(it))), ",");
592 FOREACH(Scores, true, {
593 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
594 out = strcat(out, ftos(sk.(scores(it))), ",");
597 FOREACH(Scores, true, {
598 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
599 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
600 out = strcat(out, ftos(sk.(scores(it))), ",");
602 out = substring(out, 0, strlen(out) - 1);
607 string GetTeamScoreString(float tm, float shortString)
618 for(i = 0; i < MAX_TEAMSCORE; ++i)
619 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
621 f = teamscores_flags(i);
622 l = teamscores_label(i);
623 out = strcat(out, GetScoreLogLabel(l, f), ",");
626 for(i = 0; i < MAX_TEAMSCORE; ++i)
627 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
629 f = teamscores_flags(i);
630 l = teamscores_label(i);
631 out = strcat(out, GetScoreLogLabel(l, f), ",");
634 for(i = 0; i < MAX_TEAMSCORE; ++i)
635 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
636 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
638 f = teamscores_flags(i);
639 l = teamscores_label(i);
640 out = strcat(out, GetScoreLogLabel(l, f), ",");
642 out = substring(out, 0, strlen(out) - 1);
644 else if((sk = teamscorekeepers[tm - 1]))
646 for(i = 0; i < MAX_TEAMSCORE; ++i)
647 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
648 out = strcat(out, ftos(sk.(teamscores(i))), ",");
650 for(i = 0; i < MAX_TEAMSCORE; ++i)
651 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
652 out = strcat(out, ftos(sk.(teamscores(i))), ",");
654 for(i = 0; i < MAX_TEAMSCORE; ++i)
655 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
656 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
657 out = strcat(out, ftos(sk.(teamscores(i))), ",");
658 out = substring(out, 0, strlen(out) - 1);
663 float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict)
665 if(teams && teamscores_entities_count)
667 if(p1.team != p2.team)
671 t1 = teamscorekeepers[p1.team - 1];
672 t2 = teamscorekeepers[p2.team - 1];
673 r = TeamScore_Compare(t1, t2, ((teams >= 0) ? 1 : strict));
680 return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
683 entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
685 entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
690 FOREACH_CLIENT(true, LAMBDA(it.(field) = 0));
692 FOREACH_CLIENT(it.scorekeeper,
695 if(it.frags == FRAGS_SPECTATOR)
701 // Now plist points to the whole list.
703 pfirst = plast = NULL;
708 pprev = pbestprev = NULL;
710 for(p = plist; (pprev = p), (p = p.chain); )
712 if(PlayerTeamScore_Compare(p, pbest, teams, strict) > 0)
719 // remove pbest out of the chain
720 if(pbestprev == NULL)
723 pbestprev.chain = pbest.chain;
727 if(!plast || PlayerTeamScore_Compare(plast, pbest, teams, 0))
742 float TeamScore_GetCompareValue(float t)
747 if(t <= 0 || t >= 16)
751 error("Reading score of invalid team!");
754 sk = teamscorekeepers[t - 1];
757 s = sk.teamscores_primary;
758 if(teamscores_flags_primary & SFL_ZERO_IS_WORST)
761 if(teamscores_flags_primary & SFL_LOWER_IS_BETTER)
766 const float NAMEWIDTH = 22;
767 const float SCORESWIDTH = 58;
768 // TODO put this somewhere in common?
769 string Score_NicePrint_ItemColor(float vflags)
771 if(vflags & SFL_SORT_PRIO_PRIMARY)
773 else if(vflags & SFL_SORT_PRIO_SECONDARY)
779 void Score_NicePrint_Team(entity to, float t, float w)
787 sk = teamscorekeepers[t - 1];
790 s = strcat(s, Team_ColoredFullName(t));
791 for(i = 0; i < MAX_TEAMSCORE; ++i)
792 if(teamscores_label(i) != "")
794 fl = teamscores_flags(i);
795 sc = sk.(teamscores(i));
796 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), ScoreString(fl, sc));
802 s = strcat(s, strpad(max(0, NAMEWIDTH - strlennocol(s)), ""));
804 FOREACH(Scores, true, {
805 if(scores_label(it) != "")
807 fl = scores_flags(it);
808 s2 = scores_label(it);
809 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, substring(s2, 0, w)));
816 void Score_NicePrint_Player(entity to, entity p, float w)
826 s = strcat(s, p.netname);
829 i = strlennocol(s) - NAMEWIDTH;
831 s = substring(s, 0, strlen(s) - i);
834 s = strcat(s, strpad(i, ""));
839 FOREACH(Scores, true, {
840 if(scores_label(it) != "")
842 fl = scores_flags(it);
843 sc = sk.(scores(it));
844 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, ScoreString(fl, sc)));
851 void Score_NicePrint_Spectators(entity to)
853 print_to(to, "Spectators:");
856 void Score_NicePrint_Spectator(entity to, entity p)
858 print_to(to, strcat(" ", p.netname));
861 .float score_dummyfield;
862 void Score_NicePrint(entity to)
868 FOREACH(Scores, true, {
869 if(scores_label(it) != "")
872 w = bound(6, floor(SCORESWIDTH / t - 1), 9);
874 p = PlayerScore_Sort(score_dummyfield, 1, 1, 0);
877 if(!teamscores_entities_count)
878 Score_NicePrint_Team(to, t, w);
881 if(teamscores_entities_count)
883 Score_NicePrint_Team(to, p.team, w);
884 Score_NicePrint_Player(to, p, w);
890 FOREACH_CLIENT(!IS_PLAYER(it), LAMBDA(
892 Score_NicePrint_Spectators(to);
893 Score_NicePrint_Spectator(to, it);
898 void PlayerScore_PlayerStats(entity p)
900 entity s = p.scorekeeper;
901 FOREACH(Scores, true, {
902 if(s.(scores(it)) != 0)
903 if(scores_label(it) != "")
904 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_SCOREBOARD, scores_label(it)), s.(scores(it)));
908 void PlayerScore_TeamStats()
912 for(t = 0; t < 16; ++t)
914 sk = teamscorekeepers[t];
917 for(i = 0; i < MAX_TEAMSCORE; ++i)
918 if(sk.(teamscores(i)) != 0)
919 if(teamscores_label(i) != "")
920 // the +1 is important here!
921 PS_GR_T_ADDVAL(t+1, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label(i)), sk.(teamscores(i)));