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 |= (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 |= (2 ** (i % 16));
276 void Score_ClearAll()
280 FOREACH_CLIENTSLOT(true, {
283 FOREACH(Scores, true, {
284 if(sk.(scores(it)) != 0)
285 if(scores_label(it) != "")
286 sk.SendFlags |= (2 ** (i % 16));
291 for(t = 0; t < 16; ++t)
293 sk = teamscorekeepers[t];
296 for(int j = 0; j < MAX_TEAMSCORE; ++j)
298 if(sk.(teamscores(j)) != 0)
299 if(teamscores_label(j) != "")
300 sk.SendFlags |= (2 ** j);
301 sk.(teamscores(j)) = 0;
306 void PlayerScore_Attach(entity player)
308 if(player.scorekeeper)
309 error("player already has a scorekeeper");
310 entity sk = new_pure(scorekeeper);
312 Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
313 player.scorekeeper = sk;
316 void PlayerScore_Detach(entity player)
318 if(!player.scorekeeper)
319 error("player has no scorekeeper");
320 delete(player.scorekeeper);
321 player.scorekeeper = NULL;
324 float PlayerScore_Add(entity player, PlayerScoreField scorefield, float score)
326 bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player);
327 score = M_ARGV(1, float);
330 if(!mutator_returnvalue)
333 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
334 entity s = player.scorekeeper;
339 LOG_WARN("Adding score to unknown player!");
343 if(scores_label(scorefield) != "")
344 s.SendFlags |= (2 ** (scorefield.m_id % 16));
346 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label(scorefield)), score);
347 return (s.(scores(scorefield)) += score);
350 float PlayerTeamScore_Add(entity player, PlayerScoreField pscorefield, float tscorefield, float score)
353 r = PlayerScore_Add(player, pscorefield, score);
354 if(teamscores_entities_count) // only for teamplay
355 r = TeamScore_Add(player, tscorefield, score);
359 float PlayerScore_Compare(entity t1, entity t2, float strict)
361 if(!t1 || !t2) return (!t2) - !t1;
363 vector result = '0 0 0';
364 FOREACH(Scores, true, {
365 var .float f = scores(it);
366 result = ScoreField_Compare(t1, t2, f, scores_flags(it), result, strict);
369 if (result.x == 0 && strict)
370 result.x = etof(t1.owner) - etof(t2.owner);
375 void WinningConditionHelper(entity this)
380 entity winnerscorekeeper;
381 entity secondscorekeeper;
385 // gametype:P<pure>:S<slots>::plabel,plabel:tlabel,tlabel:teamid:tscore,tscore:teamid:tscore,tscore
386 // score labels always start with a symbol or with lower case
387 // so to match pure, match for :P0:
388 // to match full, match for :S0:
390 fullstatus = autocvar_g_full_getstatus_responses;
393 s = strcat(s, ":", autocvar_g_xonoticversion);
394 s = strcat(s, ":P", ftos(cvar_purechanges_count));
395 s = strcat(s, ":S", ftos(nJoinAllowed(this, NULL)));
396 s = strcat(s, ":F", ftos(serverflags));
397 s = strcat(s, ":M", modname);
398 s = strcat(s, "::", GetPlayerScoreString(NULL, (fullstatus ? 1 : 2)));
400 if(teamscores_entities_count)
404 s = strcat(s, ":", GetTeamScoreString(0, 1));
405 for(t = 0; t < 16; ++t)
406 if(teamscorekeepers[t])
407 s = strcat(s, ":", ftos(t+1), ":", GetTeamScoreString(t+1, 1));
409 WinningConditionHelper_winnerteam = -1;
410 WinningConditionHelper_secondteam = -1;
411 winnerscorekeeper = NULL;
412 secondscorekeeper = NULL;
413 for(t = 0; t < 16; ++t)
415 sk = teamscorekeepers[t];
416 c = TeamScore_Compare(winnerscorekeeper, sk, 1);
419 WinningConditionHelper_secondteam = WinningConditionHelper_winnerteam;
420 WinningConditionHelper_winnerteam = t + 1;
421 secondscorekeeper = winnerscorekeeper;
422 winnerscorekeeper = sk;
426 c = TeamScore_Compare(secondscorekeeper, sk, 1);
429 WinningConditionHelper_secondteam = t + 1;
430 secondscorekeeper = sk;
435 WinningConditionHelper_equality = (TeamScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
436 if(WinningConditionHelper_equality)
437 WinningConditionHelper_winnerteam = WinningConditionHelper_secondteam = -1;
439 WinningConditionHelper_topscore = winnerscorekeeper.teamscores_primary;
440 WinningConditionHelper_secondscore = secondscorekeeper.teamscores_primary;
441 WinningConditionHelper_lowerisbetter = (teamscores_flags_primary & SFL_LOWER_IS_BETTER);
442 WinningConditionHelper_zeroisworst = (teamscores_flags_primary & SFL_ZERO_IS_WORST);
444 WinningConditionHelper_winner = NULL; // not supported in teamplay
445 WinningConditionHelper_second = NULL; // not supported in teamplay
449 WinningConditionHelper_winner = NULL;
450 WinningConditionHelper_second = NULL;
451 winnerscorekeeper = NULL;
452 secondscorekeeper = NULL;
453 FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
455 c = PlayerScore_Compare(winnerscorekeeper, sk, 1);
458 WinningConditionHelper_second = WinningConditionHelper_winner;
459 WinningConditionHelper_winner = it;
460 secondscorekeeper = winnerscorekeeper;
461 winnerscorekeeper = sk;
465 c = PlayerScore_Compare(secondscorekeeper, sk, 1);
468 WinningConditionHelper_second = it;
469 secondscorekeeper = sk;
474 WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
475 if(WinningConditionHelper_equality)
476 WinningConditionHelper_winner = WinningConditionHelper_second = NULL;
478 WinningConditionHelper_topscore = winnerscorekeeper.scores_primary;
479 WinningConditionHelper_secondscore = secondscorekeeper.scores_primary;
480 WinningConditionHelper_lowerisbetter = (scores_flags_primary & SFL_LOWER_IS_BETTER);
481 WinningConditionHelper_zeroisworst = (scores_flags_primary & SFL_ZERO_IS_WORST);
483 WinningConditionHelper_winnerteam = -1; // no teamplay
484 WinningConditionHelper_secondteam = -1; // no teamplay
487 if(WinningConditionHelper_topscore == 0)
489 if(scores_flags_primary & SFL_ZERO_IS_WORST)
491 if(WinningConditionHelper_lowerisbetter)
492 WinningConditionHelper_topscore = 999999999;
494 WinningConditionHelper_topscore = -999999999;
496 WinningConditionHelper_equality = 0;
499 if(WinningConditionHelper_secondscore == 0)
501 if(scores_flags_primary & SFL_ZERO_IS_WORST)
503 if(WinningConditionHelper_lowerisbetter)
504 WinningConditionHelper_secondscore = 999999999;
506 WinningConditionHelper_secondscore = -999999999;
511 strunzone(worldstatus);
512 worldstatus = strzone(s);
514 FOREACH_CLIENT(true, LAMBDA(
518 s = GetPlayerScoreString(it, 1);
519 s = strcat(s, IS_REAL_CLIENT(it) ? ":human" : ":bot");
520 if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it))
521 s = strcat(s, ":spectator");
525 if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
526 s = GetPlayerScoreString(it, 2);
532 strunzone(it.clientstatus);
533 it.clientstatus = strzone(s);
537 string GetScoreLogLabel(string label, float fl)
539 if(fl & SFL_LOWER_IS_BETTER)
540 label = strcat(label, "<");
541 if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
542 label = strcat(label, "!!");
543 else if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
544 label = strcat(label, "!");
548 string GetPlayerScoreString(entity pl, float shortString)
559 FOREACH(Scores, true, {
560 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
562 f = scores_flags(it);
563 l = scores_label(it);
564 out = strcat(out, GetScoreLogLabel(l, f), ",");
568 FOREACH(Scores, true, {
569 if((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
571 f = scores_flags(it);
572 l = scores_label(it);
573 out = strcat(out, GetScoreLogLabel(l, f), ",");
577 FOREACH(Scores, true, {
578 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
579 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
581 f = scores_flags(it);
582 l = scores_label(it);
583 out = strcat(out, GetScoreLogLabel(l, f), ",");
586 out = substring(out, 0, strlen(out) - 1);
588 else if((sk = pl.scorekeeper))
590 FOREACH(Scores, true, {
591 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
592 out = strcat(out, ftos(sk.(scores(it))), ",");
595 FOREACH(Scores, true, {
596 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
597 out = strcat(out, ftos(sk.(scores(it))), ",");
600 FOREACH(Scores, true, {
601 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
602 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
603 out = strcat(out, ftos(sk.(scores(it))), ",");
605 out = substring(out, 0, strlen(out) - 1);
610 string GetTeamScoreString(float tm, float shortString)
621 for(i = 0; i < MAX_TEAMSCORE; ++i)
622 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
624 f = teamscores_flags(i);
625 l = teamscores_label(i);
626 out = strcat(out, GetScoreLogLabel(l, f), ",");
629 for(i = 0; i < MAX_TEAMSCORE; ++i)
630 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
632 f = teamscores_flags(i);
633 l = teamscores_label(i);
634 out = strcat(out, GetScoreLogLabel(l, f), ",");
637 for(i = 0; i < MAX_TEAMSCORE; ++i)
638 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
639 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
641 f = teamscores_flags(i);
642 l = teamscores_label(i);
643 out = strcat(out, GetScoreLogLabel(l, f), ",");
645 out = substring(out, 0, strlen(out) - 1);
647 else if((sk = teamscorekeepers[tm - 1]))
649 for(i = 0; i < MAX_TEAMSCORE; ++i)
650 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
651 out = strcat(out, ftos(sk.(teamscores(i))), ",");
653 for(i = 0; i < MAX_TEAMSCORE; ++i)
654 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
655 out = strcat(out, ftos(sk.(teamscores(i))), ",");
657 for(i = 0; i < MAX_TEAMSCORE; ++i)
658 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
659 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
660 out = strcat(out, ftos(sk.(teamscores(i))), ",");
661 out = substring(out, 0, strlen(out) - 1);
666 float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict)
668 if(teams && teamscores_entities_count)
670 if(p1.team != p2.team)
674 t1 = teamscorekeepers[p1.team - 1];
675 t2 = teamscorekeepers[p2.team - 1];
676 r = TeamScore_Compare(t1, t2, ((teams >= 0) ? 1 : strict));
683 return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
686 entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
688 entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
693 FOREACH_CLIENT(true, LAMBDA(it.(field) = 0));
695 FOREACH_CLIENT(it.scorekeeper,
698 if(it.frags == FRAGS_SPECTATOR)
704 // Now plist points to the whole list.
706 pfirst = plast = NULL;
711 pprev = pbestprev = NULL;
713 for(p = plist; (pprev = p), (p = p.chain); )
715 if(PlayerTeamScore_Compare(p, pbest, teams, strict) > 0)
722 // remove pbest out of the chain
723 if(pbestprev == NULL)
726 pbestprev.chain = pbest.chain;
730 if(!plast || PlayerTeamScore_Compare(plast, pbest, teams, 0))
745 float TeamScore_GetCompareValue(float t)
750 if(t <= 0 || t >= 16)
754 error("Reading score of invalid team!");
757 sk = teamscorekeepers[t - 1];
760 s = sk.teamscores_primary;
761 if(teamscores_flags_primary & SFL_ZERO_IS_WORST)
764 if(teamscores_flags_primary & SFL_LOWER_IS_BETTER)
769 const float NAMEWIDTH = 22;
770 const float SCORESWIDTH = 58;
771 // TODO put this somewhere in common?
772 string Score_NicePrint_ItemColor(float vflags)
774 if(vflags & SFL_SORT_PRIO_PRIMARY)
776 else if(vflags & SFL_SORT_PRIO_SECONDARY)
782 void Score_NicePrint_Team(entity to, float t, float w)
790 sk = teamscorekeepers[t - 1];
793 s = strcat(s, Team_ColoredFullName(t));
794 for(i = 0; i < MAX_TEAMSCORE; ++i)
795 if(teamscores_label(i) != "")
797 fl = teamscores_flags(i);
798 sc = sk.(teamscores(i));
799 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), ScoreString(fl, sc));
805 s = strcat(s, strpad(max(0, NAMEWIDTH - strlennocol(s)), ""));
807 FOREACH(Scores, true, {
808 if(scores_label(it) != "")
810 fl = scores_flags(it);
811 s2 = scores_label(it);
812 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, substring(s2, 0, w)));
819 void Score_NicePrint_Player(entity to, entity p, float w)
829 s = strcat(s, playername(p, false));
832 i = strlennocol(s) - NAMEWIDTH;
834 s = substring(s, 0, strlen(s) - i);
837 s = strcat(s, strpad(i, ""));
842 FOREACH(Scores, true, {
843 if(scores_label(it) != "")
845 fl = scores_flags(it);
846 sc = sk.(scores(it));
847 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, ScoreString(fl, sc)));
854 void Score_NicePrint_Spectators(entity to)
856 print_to(to, "Spectators:");
859 void Score_NicePrint_Spectator(entity to, entity p)
861 print_to(to, strcat(" ", playername(p, false)));
864 .float score_dummyfield;
865 void Score_NicePrint(entity to)
871 FOREACH(Scores, true, {
872 if(scores_label(it) != "")
875 w = bound(6, floor(SCORESWIDTH / t - 1), 9);
877 p = PlayerScore_Sort(score_dummyfield, 1, 1, 0);
880 if(!teamscores_entities_count)
881 Score_NicePrint_Team(to, t, w);
884 if(teamscores_entities_count)
886 Score_NicePrint_Team(to, p.team, w);
887 Score_NicePrint_Player(to, p, w);
893 FOREACH_CLIENT(!IS_PLAYER(it), LAMBDA(
895 Score_NicePrint_Spectators(to);
896 Score_NicePrint_Spectator(to, it);
901 void PlayerScore_PlayerStats(entity p)
903 entity s = p.scorekeeper;
904 FOREACH(Scores, true, {
905 if(s.(scores(it)) != 0)
906 if(scores_label(it) != "")
907 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_SCOREBOARD, scores_label(it)), s.(scores(it)));
911 void PlayerScore_TeamStats()
915 for(t = 0; t < 16; ++t)
917 sk = teamscorekeepers[t];
920 for(i = 0; i < MAX_TEAMSCORE; ++i)
921 if(sk.(teamscores(i)) != 0)
922 if(teamscores_label(i) != "")
923 // the +1 is important here!
924 PS_GR_T_ADDVAL(t+1, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label(i)), sk.(teamscores(i)));