3 #include "command/common.qh"
4 #include "mutators/_mod.qh"
5 #include <common/net_linked.qh>
6 #include "../common/playerstats.qh"
7 #include "../common/teams.qh"
10 entity teamscorekeepers[16];
11 float teamscores_entities_count;
12 var .float scores_primary;
13 var .float teamscores_primary;
14 float scores_flags_primary;
15 float teamscores_flags_primary;
17 vector ScoreField_Compare(entity t1, entity t2, .float field, float fieldflags, vector previous, float strict) // returns: cmp value, best prio
19 if(!strict && !(fieldflags & SFL_SORT_PRIO_MASK)) // column does not sort
21 if((fieldflags & SFL_SORT_PRIO_MASK) < previous.y)
23 if (t1.(field) == t2.(field))
26 previous.y = fieldflags & SFL_SORT_PRIO_MASK;
28 if(fieldflags & SFL_ZERO_IS_WORST)
35 else if (t2.(field) == 0)
42 if (fieldflags & SFL_LOWER_IS_BETTER)
43 previous.x = (t2.(field) - t1.(field));
45 previous.x = (t1.(field) - t2.(field));
54 bool TeamScore_SendEntity(entity this, entity to, float sendflags)
56 float i, p, longflags;
58 WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
59 int t = this.team - 1;
60 assert(t, eprint(this));
61 WriteByte(MSG_ENTITY, t);
64 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
65 if(this.(teamscores(i)) > 127 || this.(teamscores(i)) <= -128)
68 #if MAX_TEAMSCORE <= 8
69 WriteByte(MSG_ENTITY, sendflags);
70 WriteByte(MSG_ENTITY, longflags);
72 WriteShort(MSG_ENTITY, sendflags);
73 WriteShort(MSG_ENTITY, longflags);
75 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
79 WriteInt24_t(MSG_ENTITY, this.(teamscores(i)));
81 WriteChar(MSG_ENTITY, this.(teamscores(i)));
87 void TeamScore_Spawn(float t, string name)
89 entity ts = new_pure(csqc_score_team);
90 ts.netname = name; // not used yet, FIXME
92 Net_LinkEntity(ts, false, 0, TeamScore_SendEntity);
93 teamscorekeepers[t - 1] = ts;
94 ++teamscores_entities_count;
95 PlayerStats_GameReport_AddTeam(t);
98 float TeamScore_AddToTeam(float t, float scorefield, float score)
105 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
106 if(t <= 0 || t >= 16)
110 error("Adding score to invalid team!");
112 s = teamscorekeepers[t - 1];
117 error("Adding score to unknown team!");
120 if(teamscores_label(scorefield) != "")
121 s.SendFlags |= pow(2, scorefield);
122 return (s.(teamscores(scorefield)) += score);
125 float TeamScore_Add(entity player, float scorefield, float score)
127 return TeamScore_AddToTeam(player.team, scorefield, score);
130 float TeamScore_Compare(entity t1, entity t2, float strict)
132 if(!t1 || !t2) return (!t2) - !t1;
134 vector result = '0 0 0';
136 for(i = 0; i < MAX_TEAMSCORE; ++i)
140 result = ScoreField_Compare(t1, t2, f, teamscores_flags(i), result, strict);
143 if (result.x == 0 && strict)
144 result.x = t1.team - t2.team;
150 * the scoreinfo entity
153 void ScoreInfo_SetLabel_PlayerScore(PlayerScoreField i, string label, float scoreflags)
155 scores_label(i) = label;
156 scores_flags(i) = scoreflags;
157 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
159 scores_primary = scores(i);
160 scores_flags_primary = scoreflags;
164 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
165 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
169 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
171 teamscores_label(i) = label;
172 teamscores_flags(i) = scoreflags;
173 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
175 teamscores_primary = teamscores(i);
176 teamscores_flags_primary = scoreflags;
180 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
181 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
185 bool ScoreInfo_SendEntity(entity this, entity to, int sf)
188 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES_INFO);
189 WriteRegistered(Gametypes, MSG_ENTITY, MapInfo_LoadedGametype);
190 FOREACH(Scores, true, {
191 WriteString(MSG_ENTITY, scores_label(it));
192 WriteByte(MSG_ENTITY, scores_flags(it));
194 for(i = 0; i < MAX_TEAMSCORE; ++i)
196 WriteString(MSG_ENTITY, teamscores_label(i));
197 WriteByte(MSG_ENTITY, teamscores_flags(i));
202 void ScoreInfo_Init(int teams)
204 if(scores_initialized)
206 scores_initialized.SendFlags |= 1; // force a resend
210 scores_initialized = new_pure(ent_client_scoreinfo);
211 Net_LinkEntity(scores_initialized, false, 0, ScoreInfo_SendEntity);
214 TeamScore_Spawn(NUM_TEAM_1, "Red");
216 TeamScore_Spawn(NUM_TEAM_2, "Blue");
218 TeamScore_Spawn(NUM_TEAM_3, "Yellow");
220 TeamScore_Spawn(NUM_TEAM_4, "Pink");
224 * per-player score entities
227 bool PlayerScore_SendEntity(entity this, entity to, float sendflags)
229 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES);
230 WriteByte(MSG_ENTITY, etof(this.owner));
233 FOREACH(Scores, true, {
234 int p = 1 << (i % 16);
235 if (this.(scores(it)) > 127 || this.(scores(it)) <= -128)
239 WriteShort(MSG_ENTITY, sendflags);
240 WriteShort(MSG_ENTITY, longflags);
241 FOREACH(Scores, true, {
242 int p = 1 << (i % 16);
246 WriteInt24_t(MSG_ENTITY, this.(scores(it)));
248 WriteChar(MSG_ENTITY, this.(scores(it)));
255 float PlayerScore_Clear(entity player)
259 if(teamscores_entities_count)
262 if(MUTATOR_CALLHOOK(ForbidPlayerScore_Clear)) return 0;
264 sk = player.scorekeeper;
265 FOREACH(Scores, true, {
266 if(sk.(scores(it)) != 0)
267 if(scores_label(it) != "")
268 sk.SendFlags |= pow(2, i % 16);
275 void Score_ClearAll()
279 FOREACH_CLIENTSLOT(true, {
282 FOREACH(Scores, true, {
283 if(sk.(scores(it)) != 0)
284 if(scores_label(it) != "")
285 sk.SendFlags |= pow(2, i % 16);
289 for(t = 0; t < 16; ++t)
291 sk = teamscorekeepers[t];
294 for(int j = 0; j < MAX_TEAMSCORE; ++j)
296 if(sk.(teamscores(j)) != 0)
297 if(teamscores_label(j) != "")
298 sk.SendFlags |= pow(2, j);
299 sk.(teamscores(j)) = 0;
304 void PlayerScore_Attach(entity player)
306 if(player.scorekeeper)
307 error("player already has a scorekeeper");
308 entity sk = new_pure(scorekeeper);
310 Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
311 player.scorekeeper = sk;
314 void PlayerScore_Detach(entity player)
316 if(!player.scorekeeper)
317 error("player has no scorekeeper");
318 delete(player.scorekeeper);
319 player.scorekeeper = NULL;
322 float PlayerScore_Add(entity player, PlayerScoreField scorefield, float score)
324 bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player);
325 score = M_ARGV(1, float);
328 if(!mutator_returnvalue)
331 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
332 entity s = player.scorekeeper;
337 LOG_WARN("Adding score to unknown player!");
341 if(scores_label(scorefield) != "")
342 s.SendFlags |= pow(2, scorefield.m_id % 16);
344 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label(scorefield)), score);
345 return (s.(scores(scorefield)) += score);
348 float PlayerTeamScore_Add(entity player, PlayerScoreField pscorefield, float tscorefield, float score)
351 r = PlayerScore_Add(player, pscorefield, score);
352 if(teamscores_entities_count) // only for teamplay
353 r = TeamScore_Add(player, tscorefield, score);
357 float PlayerScore_Compare(entity t1, entity t2, float strict)
359 if(!t1 || !t2) return (!t2) - !t1;
361 vector result = '0 0 0';
362 FOREACH(Scores, true, {
363 var .float f = scores(it);
364 result = ScoreField_Compare(t1, t2, f, scores_flags(it), result, strict);
367 if (result.x == 0 && strict)
368 result.x = etof(t1.owner) - etof(t2.owner);
373 void WinningConditionHelper(entity this)
378 entity winnerscorekeeper;
379 entity secondscorekeeper;
383 // gametype:P<pure>:S<slots>::plabel,plabel:tlabel,tlabel:teamid:tscore,tscore:teamid:tscore,tscore
384 // score labels always start with a symbol or with lower case
385 // so to match pure, match for :P0:
386 // to match full, match for :S0:
388 fullstatus = autocvar_g_full_getstatus_responses;
391 s = strcat(s, ":", autocvar_g_xonoticversion);
392 s = strcat(s, ":P", ftos(cvar_purechanges_count));
393 s = strcat(s, ":S", ftos(nJoinAllowed(this, NULL)));
394 s = strcat(s, ":F", ftos(serverflags));
395 s = strcat(s, ":M", modname);
396 s = strcat(s, "::", GetPlayerScoreString(NULL, (fullstatus ? 1 : 2)));
398 if(teamscores_entities_count)
402 s = strcat(s, ":", GetTeamScoreString(0, 1));
403 for(t = 0; t < 16; ++t)
404 if(teamscorekeepers[t])
405 s = strcat(s, ":", ftos(t+1), ":", GetTeamScoreString(t+1, 1));
407 WinningConditionHelper_winnerteam = -1;
408 WinningConditionHelper_secondteam = -1;
409 winnerscorekeeper = NULL;
410 secondscorekeeper = NULL;
411 for(t = 0; t < 16; ++t)
413 sk = teamscorekeepers[t];
414 c = TeamScore_Compare(winnerscorekeeper, sk, 1);
417 WinningConditionHelper_secondteam = WinningConditionHelper_winnerteam;
418 WinningConditionHelper_winnerteam = t + 1;
419 secondscorekeeper = winnerscorekeeper;
420 winnerscorekeeper = sk;
424 c = TeamScore_Compare(secondscorekeeper, sk, 1);
427 WinningConditionHelper_secondteam = t + 1;
428 secondscorekeeper = sk;
433 WinningConditionHelper_equality = (TeamScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
434 if(WinningConditionHelper_equality)
435 WinningConditionHelper_winnerteam = WinningConditionHelper_secondteam = -1;
437 WinningConditionHelper_topscore = winnerscorekeeper.teamscores_primary;
438 WinningConditionHelper_secondscore = secondscorekeeper.teamscores_primary;
439 WinningConditionHelper_lowerisbetter = (teamscores_flags_primary & SFL_LOWER_IS_BETTER);
440 WinningConditionHelper_zeroisworst = (teamscores_flags_primary & SFL_ZERO_IS_WORST);
442 WinningConditionHelper_winner = NULL; // not supported in teamplay
443 WinningConditionHelper_second = NULL; // not supported in teamplay
447 WinningConditionHelper_winner = NULL;
448 WinningConditionHelper_second = NULL;
449 winnerscorekeeper = NULL;
450 secondscorekeeper = NULL;
451 FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
453 c = PlayerScore_Compare(winnerscorekeeper, sk, 1);
456 WinningConditionHelper_second = WinningConditionHelper_winner;
457 WinningConditionHelper_winner = it;
458 secondscorekeeper = winnerscorekeeper;
459 winnerscorekeeper = sk;
463 c = PlayerScore_Compare(secondscorekeeper, sk, 1);
466 WinningConditionHelper_second = it;
467 secondscorekeeper = sk;
472 WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
473 if(WinningConditionHelper_equality)
474 WinningConditionHelper_winner = WinningConditionHelper_second = NULL;
476 WinningConditionHelper_topscore = winnerscorekeeper.scores_primary;
477 WinningConditionHelper_secondscore = secondscorekeeper.scores_primary;
478 WinningConditionHelper_lowerisbetter = (scores_flags_primary & SFL_LOWER_IS_BETTER);
479 WinningConditionHelper_zeroisworst = (scores_flags_primary & SFL_ZERO_IS_WORST);
481 WinningConditionHelper_winnerteam = -1; // no teamplay
482 WinningConditionHelper_secondteam = -1; // no teamplay
485 if(WinningConditionHelper_topscore == 0)
487 if(scores_flags_primary & SFL_ZERO_IS_WORST)
489 if(WinningConditionHelper_lowerisbetter)
490 WinningConditionHelper_topscore = 999999999;
492 WinningConditionHelper_topscore = -999999999;
494 WinningConditionHelper_equality = 0;
497 if(WinningConditionHelper_secondscore == 0)
499 if(scores_flags_primary & SFL_ZERO_IS_WORST)
501 if(WinningConditionHelper_lowerisbetter)
502 WinningConditionHelper_secondscore = 999999999;
504 WinningConditionHelper_secondscore = -999999999;
509 strunzone(worldstatus);
510 worldstatus = strzone(s);
512 FOREACH_CLIENT(true, LAMBDA(
516 s = GetPlayerScoreString(it, 1);
517 s = strcat(s, IS_REAL_CLIENT(it) ? ":human" : ":bot");
518 if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it))
519 s = strcat(s, ":spectator");
523 if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
524 s = GetPlayerScoreString(it, 2);
530 strunzone(it.clientstatus);
531 it.clientstatus = strzone(s);
535 string GetScoreLogLabel(string label, float fl)
537 if(fl & SFL_LOWER_IS_BETTER)
538 label = strcat(label, "<");
539 if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
540 label = strcat(label, "!!");
541 else if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
542 label = strcat(label, "!");
546 string GetPlayerScoreString(entity pl, float shortString)
557 FOREACH(Scores, true, {
558 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
560 f = scores_flags(it);
561 l = scores_label(it);
562 out = strcat(out, GetScoreLogLabel(l, f), ",");
566 FOREACH(Scores, true, {
567 if((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
569 f = scores_flags(it);
570 l = scores_label(it);
571 out = strcat(out, GetScoreLogLabel(l, f), ",");
575 FOREACH(Scores, true, {
576 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
577 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
579 f = scores_flags(it);
580 l = scores_label(it);
581 out = strcat(out, GetScoreLogLabel(l, f), ",");
584 out = substring(out, 0, strlen(out) - 1);
586 else if((sk = pl.scorekeeper))
588 FOREACH(Scores, true, {
589 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
590 out = strcat(out, ftos(sk.(scores(it))), ",");
593 FOREACH(Scores, true, {
594 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
595 out = strcat(out, ftos(sk.(scores(it))), ",");
598 FOREACH(Scores, true, {
599 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
600 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
601 out = strcat(out, ftos(sk.(scores(it))), ",");
603 out = substring(out, 0, strlen(out) - 1);
608 string GetTeamScoreString(float tm, float shortString)
619 for(i = 0; i < MAX_TEAMSCORE; ++i)
620 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
622 f = teamscores_flags(i);
623 l = teamscores_label(i);
624 out = strcat(out, GetScoreLogLabel(l, f), ",");
627 for(i = 0; i < MAX_TEAMSCORE; ++i)
628 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
630 f = teamscores_flags(i);
631 l = teamscores_label(i);
632 out = strcat(out, GetScoreLogLabel(l, f), ",");
635 for(i = 0; i < MAX_TEAMSCORE; ++i)
636 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
637 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
639 f = teamscores_flags(i);
640 l = teamscores_label(i);
641 out = strcat(out, GetScoreLogLabel(l, f), ",");
643 out = substring(out, 0, strlen(out) - 1);
645 else if((sk = teamscorekeepers[tm - 1]))
647 for(i = 0; i < MAX_TEAMSCORE; ++i)
648 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
649 out = strcat(out, ftos(sk.(teamscores(i))), ",");
651 for(i = 0; i < MAX_TEAMSCORE; ++i)
652 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
653 out = strcat(out, ftos(sk.(teamscores(i))), ",");
655 for(i = 0; i < MAX_TEAMSCORE; ++i)
656 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
657 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
658 out = strcat(out, ftos(sk.(teamscores(i))), ",");
659 out = substring(out, 0, strlen(out) - 1);
664 float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict)
666 if(teams && teamscores_entities_count)
668 if(p1.team != p2.team)
672 t1 = teamscorekeepers[p1.team - 1];
673 t2 = teamscorekeepers[p2.team - 1];
674 r = TeamScore_Compare(t1, t2, ((teams >= 0) ? 1 : strict));
681 return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
684 entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
686 entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
691 FOREACH_CLIENT(true, LAMBDA(it.(field) = 0));
693 FOREACH_CLIENT(it.scorekeeper,
696 if(it.frags == FRAGS_SPECTATOR)
702 // Now plist points to the whole list.
704 pfirst = plast = NULL;
709 pprev = pbestprev = NULL;
711 for(p = plist; (pprev = p), (p = p.chain); )
713 if(PlayerTeamScore_Compare(p, pbest, teams, strict) > 0)
720 // remove pbest out of the chain
721 if(pbestprev == NULL)
724 pbestprev.chain = pbest.chain;
728 if(!plast || PlayerTeamScore_Compare(plast, pbest, teams, 0))
743 float TeamScore_GetCompareValue(float t)
748 if(t <= 0 || t >= 16)
752 error("Reading score of invalid team!");
755 sk = teamscorekeepers[t - 1];
758 s = sk.teamscores_primary;
759 if(teamscores_flags_primary & SFL_ZERO_IS_WORST)
762 if(teamscores_flags_primary & SFL_LOWER_IS_BETTER)
767 const float NAMEWIDTH = 22;
768 const float SCORESWIDTH = 58;
769 // TODO put this somewhere in common?
770 string Score_NicePrint_ItemColor(float vflags)
772 if(vflags & SFL_SORT_PRIO_PRIMARY)
774 else if(vflags & SFL_SORT_PRIO_SECONDARY)
780 void Score_NicePrint_Team(entity to, float t, float w)
788 sk = teamscorekeepers[t - 1];
791 s = strcat(s, Team_ColoredFullName(t));
792 for(i = 0; i < MAX_TEAMSCORE; ++i)
793 if(teamscores_label(i) != "")
795 fl = teamscores_flags(i);
796 sc = sk.(teamscores(i));
797 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), ScoreString(fl, sc));
803 s = strcat(s, strpad(max(0, NAMEWIDTH - strlennocol(s)), ""));
805 FOREACH(Scores, true, {
806 if(scores_label(it) != "")
808 fl = scores_flags(it);
809 s2 = scores_label(it);
810 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, substring(s2, 0, w)));
817 void Score_NicePrint_Player(entity to, entity p, float w)
827 s = strcat(s, playername(p, false));
830 i = strlennocol(s) - NAMEWIDTH;
832 s = substring(s, 0, strlen(s) - i);
835 s = strcat(s, strpad(i, ""));
840 FOREACH(Scores, true, {
841 if(scores_label(it) != "")
843 fl = scores_flags(it);
844 sc = sk.(scores(it));
845 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, ScoreString(fl, sc)));
852 void Score_NicePrint_Spectators(entity to)
854 print_to(to, "Spectators:");
857 void Score_NicePrint_Spectator(entity to, entity p)
859 print_to(to, strcat(" ", playername(p, false)));
862 .float score_dummyfield;
863 void Score_NicePrint(entity to)
869 FOREACH(Scores, true, {
870 if(scores_label(it) != "")
873 w = bound(6, floor(SCORESWIDTH / t - 1), 9);
875 p = PlayerScore_Sort(score_dummyfield, 1, 1, 0);
878 if(!teamscores_entities_count)
879 Score_NicePrint_Team(to, t, w);
882 if(teamscores_entities_count)
884 Score_NicePrint_Team(to, p.team, w);
885 Score_NicePrint_Player(to, p, w);
891 FOREACH_CLIENT(!IS_PLAYER(it), LAMBDA(
893 Score_NicePrint_Spectators(to);
894 Score_NicePrint_Spectator(to, it);
899 void PlayerScore_PlayerStats(entity p)
901 entity s = p.scorekeeper;
902 FOREACH(Scores, true, {
903 if(s.(scores(it)) != 0)
904 if(scores_label(it) != "")
905 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_SCOREBOARD, scores_label(it)), s.(scores(it)));
909 void PlayerScore_TeamStats()
913 for(t = 0; t < 16; ++t)
915 sk = teamscorekeepers[t];
918 for(i = 0; i < MAX_TEAMSCORE; ++i)
919 if(sk.(teamscores(i)) != 0)
920 if(teamscores_label(i) != "")
921 // the +1 is important here!
922 PS_GR_T_ADDVAL(t+1, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label(i)), sk.(teamscores(i)));