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

Function renderscores

source/src/scoreboard.cpp:281–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281void renderscores(void *menu, bool init)
282{
283 if(needscoresreorder) reorderscorecolumns();
284 static string modeline, serverline;
285
286 modeline[0] = '\0';
287 serverline[0] = '\0';
288 scorelines.shrink(0);
289
290 vector<playerent *> scores;
291 if(!watchingdemo) scores.add(player1);
292 totalplayers = 1;
293 loopv(players) if(players[i]) { scores.add(players[i]); totalplayers++; }
294 scores.sort(scorecmp);
295 discscores.sort(discscorecmp);
296
297 int spectators = 0;
298 loopv(scores) if(scores[i]->team == TEAM_SPECT) spectators++;
299 loopv(discscores) if(discscores[i].team == TEAM_SPECT) spectators++;
300
301 int winner = -1;
302 if(m_teammode)
303 {
304 teamscore teamscores[2] = { teamscore(TEAM_CLA), teamscore(TEAM_RVSF) };
305
306 loopv(scores) if(scores[i]->team != TEAM_SPECT) teamscores[team_base(scores[i]->team)].addplayer(scores[i]);
307 loopv(discscores) if(discscores[i].team != TEAM_SPECT) teamscores[team_base(discscores[i].team)].addscore(discscores[i]);
308
309 int sort = teamscorecmp(&teamscores[TEAM_CLA], &teamscores[TEAM_RVSF]) < 0 ? 0 : 1;
310 loopi(2)
311 {
312 renderteamscore(&teamscores[sort ^ i]);
313 renderdiscscores(sort ^ i);
314 }
315 winner = m_flags_ ?
316 (teamscores[sort].flagscore > teamscores[team_opposite(sort)].flagscore ? sort : -1) :
317 (teamscores[sort].frags > teamscores[team_opposite(sort)].frags ? sort : -1);
318
319 }
320 else
321 { // ffa mode
322 loopv(scores) if(scores[i]->team != TEAM_SPECT) renderscore(scores[i]);
323 loopi(2) renderdiscscores(i);
324 if(scores.length() > 0)
325 {
326 winner = scores[0]->clientnum;
327 if(scores.length() > 1
328 && ((m_flags_ && scores[0]->flagscore == scores[1]->flagscore)
329 || (!m_flags_ && scores[0]->frags == scores[1]->frags)))
330 winner = -1;
331 }
332 }
333 if(spectators)
334 {
335 if(!scorelines.empty()) // space between teams and spectators
336 {
337 sline &space = scorelines.add();
338 space.s[0] = 0;

Callers

nothing calls this directly

Calls 15

reorderscorecolumnsFunction · 0.85
teamscoreClass · 0.85
teamscorecmpFunction · 0.85
renderteamscoreFunction · 0.85
renderdiscscoresFunction · 0.85
renderscoreFunction · 0.85
getclientmapFunction · 0.85
modestrFunction · 0.85
multiplayerFunction · 0.85
concatstringFunction · 0.85
concatformatstringFunction · 0.85
getconnectedserverinfoFunction · 0.85

Tested by

no test coverage detected