MCPcopy Create free account
hub / github.com/assaultcube/AC / winners

Function winners

source/src/scoreboard.cpp:509–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509void winners()
510{
511 string winners = "";
512 vector<playerent *> scores;
513 if(!watchingdemo) scores.add(player1);
514 loopv(players) if(players[i]) { scores.add(players[i]); }
515 scores.sort(scorecmp);
516 discscores.sort(discscorecmp);
517
518 if(m_teammode)
519 {
520 teamscore teamscores[2] = { teamscore(TEAM_CLA), teamscore(TEAM_RVSF) };
521
522 loopv(scores) if(scores[i]->team != TEAM_SPECT) teamscores[team_base(scores[i]->team)].addplayer(scores[i]);
523 loopv(discscores) if(discscores[i].team != TEAM_SPECT)
524 teamscores[team_base(discscores[i].team)].addscore(discscores[i]);
525
526 int sort = teamscorecmp(&teamscores[TEAM_CLA], &teamscores[TEAM_RVSF]);
527 if(!sort) copystring(winners, "0 1");
528 else itoa(winners, sort < 0 ? 0 : 1);
529 }
530 else
531 {
532 loopv(scores)
533 {
534 if(!i || !scorecmp(&scores[i], &scores[i-1])) concatformatstring(winners, "%s%d", i ? " " : "", scores[i]->clientnum);
535 else break;
536 }
537 }
538
539 result(winners);
540}
541
542COMMAND(winners, "");

Callers

nothing calls this directly

Calls 9

teamscoreClass · 0.85
teamscorecmpFunction · 0.85
copystringFunction · 0.85
resultFunction · 0.85
sortMethod · 0.80
addplayerMethod · 0.80
addscoreMethod · 0.80
loopvFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected