6 #include "resolution.h"
7 #include "groupscreen.h"
8 #include "fetch_group.h"
9 #include "fetch_max_score_for_songs.h"
10 #include "fetch_max_score_for_players.h"
11 #include "fetch_needs_update.h"
12 #include "fetch_highscore.h"
16 std::string theme_suffix_from_row(unsigned row)
25 GroupScreen::GroupScreen(pqxx::connection &conn, unsigned tournament, unsigned round, unsigned parallel, unsigned machine, unsigned num_machines, unsigned players_per_machine)
26 : tournament(tournament), round(round), parallel(parallel), machine(machine), num_machines(num_machines), players_per_machine(players_per_machine), scores_changed(conn, "scores"), conn(conn), valid(false)
30 GroupScreen::~GroupScreen()
34 bool GroupScreen::check_invalidated()
38 if (!scores_changed.get_flag())
40 scores_changed.reset_flag();
43 conn.perform(FetchNeedsUpdate(last_updated, tournament, round, parallel, &needs_update));
45 valid = !needs_update;
49 unsigned GroupScreen::get_show_players(const Group &group)
51 unsigned num_players_this_machine = (group.players.size() + num_machines - machine - 1) / num_machines;
52 return std::min(num_players_this_machine, 9U);
55 void GroupScreen::draw_main_heading(std::vector<TextDefer> &td)
58 if (num_machines == 1) {
60 std::sprintf(heading, "Round %u", round);
62 std::sprintf(heading, "Round %u, Group %u", round, parallel);
66 std::sprintf(heading, "Round %u, Machine %u", round, machine + 1);
68 std::sprintf(heading, "Round %u, Group %u, Machine %u", round, parallel, machine + 1);
72 unsigned width = my_draw_text(heading, NULL, 40.0, "mainheading");
73 my_draw_text_deferred(td, heading, 40.0, "mainheading", "mainheading", LOGICAL_SCREEN_WIDTH/2 - width/2, 60);
76 // make column headings from the first player's songs
77 void GroupScreen::draw_column_headings(std::vector<TextDefer> &td, const Group &group, const std::vector<unsigned> &colwidth)
79 unsigned num_scores = group.players[0].scores.size();
82 unsigned x = 40 + colwidth[0];
83 for (std::vector<Score>::const_iterator i = group.players[0].scores.begin(); i != group.players[0].scores.end(); ++i, ++col) {
85 unsigned this_width = my_draw_text(i->song.short_title, NULL, 12.0, "columnheading");
86 my_draw_text_deferred(td, i->song.short_title, 12.0, "columnheading", "columnheading", x + colwidth[col] / 2 - this_width / 2, 100);
88 x += colwidth[col] + 20;
92 unsigned this_width = my_draw_text("Total", NULL, 12.0, "columnheading");
93 my_draw_text_deferred(td, "Total", 12.0, "columnheading", "columnheading", x + colwidth[num_scores + 1] / 2 - this_width / 2, 100);
94 x += colwidth[num_scores + 1] + 20;
96 unsigned this_width = my_draw_text("Rank", NULL, 12.0, "columnheading");
97 my_draw_text_deferred(td, "Rank", 12.0, "columnheading", "columnheading", x + colwidth[num_scores + 2] / 2 - this_width / 2, 100);
100 // show all the players and the scores
101 void GroupScreen::draw_scores(std::vector<TextDefer> &td, const Group &group, unsigned min_player, const std::vector<unsigned> &colwidth)
103 unsigned max_num_width = my_draw_text("8888", NULL, 22.0, "score");
104 unsigned num_scores = group.players[0].scores.size();
105 unsigned show_players = get_show_players(group);
106 unsigned y = (show_players <= 7) ? 140 : (140 - (show_players - 7) * 5);
108 unsigned row = 0, m = 0, x;
109 for (std::vector<Player>::const_iterator i = group.players.begin(); i != group.players.end() && row < 9; ++i) {
110 if (m++ % num_machines != machine)
112 if (m-1 < min_player)
115 std::string suffix = theme_suffix_from_row(row);
117 my_draw_text_deferred(td, i->nick, 18.0, "rowheading" + suffix, "rowheading" + suffix, 20, y);
119 x = 40 + colwidth[0];
122 for (std::vector<Score>::const_iterator j = i->scores.begin(); j != i->scores.end(); ++j, ++col) {
124 if (j->score != -1) {
125 std::sprintf(text, "%u", j->score);
128 unsigned this_width = my_draw_text(text, NULL, 22.0, "score" + suffix);
130 my_draw_text_deferred(td, text, 22.0, "score" + suffix, "freshscore" + suffix, x + max_num_width - this_width, y);
132 // draw the long name if we can, otherwise use the short one
133 if (my_draw_text(j->song.title, NULL, 12.0, "chosensongname") > (colwidth[col] - 10 - max_num_width)) {
134 my_draw_text_deferred(td, j->song.short_title, 12.0, "chosensongname" + suffix, "freshchosensongname" + suffix, x + max_num_width + 10, y);
136 my_draw_text_deferred(td, j->song.title, 12.0, "chosensongname" + suffix, "freshchosensongname" + suffix, x + max_num_width + 10, y);
139 my_draw_text_deferred(td, text, 22.0, "score" + suffix, "freshscore" + suffix, x + colwidth[col] / 2 - this_width / 2, y);
141 x += colwidth[col] + 20;
145 if (num_scores > 1) {
147 std::sprintf(text, "%u", i->total);
149 unsigned this_width = my_draw_text(text, NULL, 22.0, "totalscore" + suffix);
150 my_draw_text_deferred(td, text, 22.0, "totalscore" + suffix, "freshtotalscore" + suffix, x + colwidth[num_scores + 1] / 2 - this_width / 2, y);
151 x += colwidth[num_scores + 1] + 20;
154 if (show_players > 7)
155 y += 40 - (show_players - 7) * 4;
163 * Find out how wide each column has to be. First try unlimited width (ie.
164 * long titles for everything); if that gets too long, try again with short
165 * titles for chosen songs.
167 void GroupScreen::find_column_widths(const Group &group, std::vector<unsigned> &colwidth)
170 unsigned max_num_width = my_draw_text("8888", NULL, 22.0, "score");
171 unsigned sumcolwidth;
173 for (unsigned mode = 0; mode < 2; ++mode) {
174 for (std::vector<Player>::const_iterator i = group.players.begin(); i != group.players.end(); ++i) {
177 if (colwidth.size() == 0)
178 colwidth.push_back(0);
180 colwidth[0] = std::max(colwidth[0], my_draw_text(i->nick, NULL, 18.0, "rowheading"));
182 for (std::vector<Score>::const_iterator j = i->scores.begin(); j != i->scores.end(); ++j, ++col) {
183 if (colwidth.size() < col+1)
184 colwidth.push_back(0);
187 colwidth[col] = std::max(colwidth[col], my_draw_text((mode == 0) ? j->song.title : j->song.short_title, NULL, 12.0, "chosensongname") +
190 colwidth[col] = std::max(colwidth[col], my_draw_text(j->song.short_title, NULL, 12.0, "randomsongname"));
191 colwidth[col] = std::max(colwidth[col], max_num_width);
196 num_scores = group.players[0].scores.size();
198 if (colwidth.size() < num_scores + 2) {
199 colwidth.push_back(0);
200 colwidth.push_back(0);
203 if (num_scores > 1) {
204 colwidth[num_scores + 1] = std::max(my_draw_text("Total", NULL, 12.0, "columnheading"), max_num_width);
206 colwidth[num_scores + 2] = my_draw_text("Rank", NULL, 12.0, "columnheading");
208 // if we're at long titles and that works, don't try the short ones
211 for (unsigned i = 0; i <= num_scores + 2; ++i)
212 sumcolwidth += colwidth[i] + 20;
214 if (sumcolwidth < LOGICAL_SCREEN_WIDTH - 20)
218 colwidth.erase(colwidth.begin(), colwidth.end());
223 * If we have space to go, distribute as much as we can to the chosen song column, so we won't have
224 * total and rank jumping around.
226 if (sumcolwidth < LOGICAL_SCREEN_WIDTH - 20) {
227 int first_chosen_col = -1;
230 for (std::vector<Score>::const_iterator i = group.players[0].scores.begin(); i != group.players[0].scores.end(); ++i, ++col) {
232 first_chosen_col = col;
237 if (first_chosen_col != -1) {
238 colwidth[first_chosen_col] += LOGICAL_SCREEN_WIDTH - 20 - sumcolwidth;
243 /* Find the first player with the fewest songs played and part of this machine. */
244 const Player *GroupScreen::get_next_player(const Group &group)
246 unsigned min_played_songs = 9999;
247 const Player *next_player = NULL;
249 for (std::vector<Player>::const_iterator i = group.players.begin(); i != group.players.end(); ++i) {
250 unsigned this_played = 0;
251 for (std::vector<Score>::const_iterator j = i->scores.begin(); j != i->scores.end(); ++j) {
256 if ((m++ % num_machines == machine) && this_played < min_played_songs) {
257 min_played_songs = this_played;
266 * At the bottom, for a single player, is "who's playing, what will he/she be
267 * playing, and optionally, how much to lead/win and how much to secure
268 * qualification" (the last one only in the final round). We assume playing is
269 * done in a modified zigzag; all the random songs are played first in
270 * zigzag/wrapping order (player 1 song 1, player 2 song 2, player 3 song 3,
271 * player 1 song 2, player 2 song 3, player 3 song 1, etc... assuming three
272 * songs and three players) and then all the chosen songs are played (we assume
273 * only one chosen song).
275 * The lines are as follows:
279 * High score: <hs> by <hsplayer> at <hsevent>
280 * Needs to lead: <leadscore>
281 * Needs to secure qualification: <qualscore>
282 * Needs to win group: <winscore>
284 void GroupScreen::draw_next_up_single(unsigned char *buf, const Group &group,
285 std::map<unsigned, unsigned> &song_scores, std::map<unsigned, unsigned> &player_scores,
286 const std::vector<unsigned> &max_score, const std::vector<unsigned> &min_score)
288 unsigned num_scores = group.players[0].scores.size();
290 // Find out how many random songs there are (equal for all players).
291 unsigned num_random_songs = 0;
292 for (std::vector<Score>::const_iterator i = group.players[0].scores.begin(); i != group.players[0].scores.end(); ++i) {
298 * Find out which player is next, and what song he she is supposed to play. First
301 const Player *next_player = get_next_player(group);
302 const Score *next_song = NULL;
304 for (unsigned i = 0; i < num_random_songs; ++i) {
305 unsigned j = (i + next_player->position - 1) % num_random_songs;
306 if (next_player->scores[j].score == -1) {
307 next_song = &(next_player->scores[j]);
312 // then all songs, if that didn't work out (slightly icky, but hey)
313 if (next_song == NULL) {
314 for (unsigned i = 0; i < num_scores; ++i) {
315 unsigned j = (i + next_player->position) % num_scores;
316 if (next_player->scores[j].score == -1) {
317 next_song = &(next_player->scores[j]);
323 if (next_song != NULL) {
324 // find out how many songs we've played in all
325 unsigned num_played = 0;
326 for (unsigned i = 0; i < num_scores; ++i) {
327 if (next_player->scores[i].score != -1) {
332 bool last_song = (num_played == num_scores - 1);
334 draw_next_up_player(buf, group, *next_player, *next_song, last_song, song_scores, player_scores, max_score, min_score);
339 * Some tournaments allow versus play in the initial rounds to save time; this is
340 * of course for random songs only. In this case, the scheme from draw_next_up_single()
341 * is somewhat changed, as we zig-zag across pairs instead of players. (If there's a
342 * stray person left in the group, that player plays the song by him-/herself as in
343 * a usual single tournament.
345 void GroupScreen::draw_next_up_versus(unsigned char *buf, const Group &group,
346 std::map<unsigned, unsigned> &song_scores, std::map<unsigned, unsigned> &player_scores,
347 const std::vector<unsigned> &max_score, const std::vector<unsigned> &min_score)
349 // Find out how many random songs there are (equal for all players).
350 unsigned num_random_songs = 0;
351 for (std::vector<Score>::const_iterator i = group.players[0].scores.begin(); i != group.players[0].scores.end(); ++i) {
356 // Find the next player and what song he/she is supposed to play, if any.
357 const Player *next_player = get_next_player(group);
358 const Score *next_song = NULL;
361 for (unsigned i = 0; i < num_random_songs; ++i) {
362 unsigned j = (i + (next_player->position - 1) / 2) % num_random_songs;
363 if (next_player->scores[j].score == -1) {
364 next_song = &(next_player->scores[j]);
371 * If there's no match, we're on the chosen songs (or done),
372 * so just delegate to draw_up_single().
374 if (next_song == NULL) {
375 draw_next_up_single(buf, group, song_scores, player_scores, max_score, min_score);
380 * Look for a player with the same amount of random songs played _and_ missing
383 unsigned num_songs_played = 0;
384 for (unsigned i = 0; i < num_random_songs; ++i) {
385 if (next_player->scores[i].score != -1) {
391 const Player *other_player = NULL;
392 for (std::vector<Player>::const_iterator i = group.players.begin(); i != group.players.end(); ++i) {
393 if ((m++ % num_machines != machine))
395 if (i->id == next_player->id)
398 unsigned this_songs_played = 0;
399 for (unsigned j = 0; j < num_random_songs; ++j) {
400 if (i->scores[j].score != -1) {
405 if (this_songs_played != num_songs_played)
408 if (i->scores[song_num].score == -1) {
409 other_player = &(*i);
414 // If we didn't find another player, just draw the one we have as usual.
415 if (other_player == NULL) {
416 draw_next_up_player(buf, group, *next_player, *next_song, false,
417 song_scores, player_scores, max_score, min_score);
421 // OK, we have two players. Draw their nicks and the scores
422 widestring text = widestring("Next players: ") + next_player->nick + widestring(" and ") + other_player->nick;
423 unsigned this_width = my_draw_text(text, NULL, 24.0, "nextsonginfo");
424 my_draw_text(text, buf, 24.0, "nextsonginfo", (LOGICAL_SCREEN_WIDTH/2) - this_width/2, 420);
426 if (next_song->song.id != -1) {
427 this_width = my_draw_text(next_song->song.title, NULL, 20.0, "nextsongtitle");
428 my_draw_text(next_song->song.title, buf, 20.0, "nextsonginfo", (LOGICAL_SCREEN_WIDTH/2) - this_width/2, 457);
431 conn.perform(FetchHighscore(next_song->song.id, &hs));
433 if (hs.score != -1) {
434 text = widestring("High score: ") + widestring(pqxx::to_string(hs.score)) +
435 widestring(", by ") + hs.nick + widestring(" in ") + hs.tournament_name;
436 this_width = my_draw_text(text, NULL, 16.0, "nextsonginfo");
437 my_draw_text(text, buf, 16.0, "nextsonginfo", (LOGICAL_SCREEN_WIDTH/2) - this_width/2, 487);
442 void GroupScreen::draw_next_up_player(unsigned char *buf, const Group &group, const Player &player, const Score &song, bool last_song,
443 std::map<unsigned, unsigned> &song_scores, std::map<unsigned, unsigned> &player_scores,
444 const std::vector<unsigned> &max_score, const std::vector<unsigned> &min_score)
446 widestring text = widestring("Next player: ") + player.nick;
447 unsigned this_width = my_draw_text(text, NULL, 24.0, "nextsonginfo");
448 my_draw_text(text, buf, 24.0, "nextsonginfo", (LOGICAL_SCREEN_WIDTH/2) - this_width/2, 420);
450 if (song.song.id != -1) {
451 this_width = my_draw_text(song.song.title, NULL, 20.0, "nextsonginfo");
452 my_draw_text(song.song.title, buf, 20.0, "nextsonginfo", (LOGICAL_SCREEN_WIDTH/2) - this_width/2, 457);
455 conn.perform(FetchHighscore(song.song.id, &hs));
457 if (hs.score != -1) {
458 text = widestring("High score: ") + widestring(pqxx::to_string(hs.score)) +
459 widestring(", by ") + hs.nick + widestring(" in ") + hs.tournament_name;
460 this_width = my_draw_text(text, NULL, 16.0, "nextsonginfo");
461 my_draw_text(text, buf, 16.0, "nextsonginfo", (LOGICAL_SCREEN_WIDTH/2) - this_width/2, 487);
465 // only show lead/win/qualify for the last song
468 * Find out how much we need to lead, how much we need to be guaranteed
469 * to win the group, and how much we need to secure qualification.
472 // find the best score we can get
473 unsigned max_score_this_song;
474 if (song.song.id != -1) {
475 // random song, or we know what song the player picked
476 max_score_this_song = song_scores[song.song.id];
478 max_score_this_song = player_scores[player.id];
483 // see what score this player must beat to lead
484 unsigned lead_beat = 0, win_beat = 0;
485 for (unsigned i = 0; i < group.players.size(); ++i) {
486 if (group.players[i].id == player.id)
489 lead_beat = std::max(lead_beat, group.players[i].total);
492 // find the best max score among the others
493 for (unsigned i = 0; i < group.players.size(); ++i) {
494 if (group.players[i].id == player.id)
497 win_beat = std::max(win_beat, max_score[i]);
501 * There's a somewhat subtle point here. Normally, what a player would be interested in
502 * with regard to qualification would be a set of three values:
504 * 1. How much is the absolute minimum required to qualify, given that all others
506 * 2. How much will give a reasonable chance of qualifying, given the expected performance
508 * 3. How much will be enough to secure qualification, no matter what?
510 * Given perfect guessing, #2 would be "how much is needed to qualify"; however, it is
511 * completely impossible to give an exact value for that, and we're not into the guessing
512 * games. :-) #1 is often so low it's completely unrealistic (ie. far enough from #2 that
513 * it's not interesting), but #3, the most conservative estimate, is often a good measure.
514 * #3 is "how much is needed to _secure_ qualification", and that is usually what we
515 * print out when it's possible.
517 * However, in a few situations, #1 and #3 will be the exact same value, from which it
518 * follows (from the squeeze law, or just common sense :-) ) that #2 will be the same
519 * value as #1 and #3. (This usually happens near or at the end of a group.) In that
520 * case, we know the value we seek (ie. "how much is needed to qualify"), so we drop
521 * the word "secure" and just print it as-is.
523 * To find #1 and #3, we sort and pick out the values we need to beat in the best and
526 int qualify_beat_worst_case = -1, qualify_beat_best_case = -1;
528 if (group.num_qualifying > 0) {
529 std::vector<unsigned> tmp;
531 for (unsigned i = 0; i < group.players.size(); ++i) {
532 if (group.players[i].id == player.id)
534 tmp.push_back(max_score[i]);
536 std::sort(tmp.begin(), tmp.end());
537 qualify_beat_worst_case = tmp[tmp.size() - group.num_qualifying];
539 std::vector<unsigned> tmp2;
540 for (unsigned i = 0; i < group.players.size(); ++i) {
541 if (group.players[i].id == player.id)
543 tmp2.push_back(min_score[i]);
546 std::sort(tmp2.begin(), tmp2.end());
547 qualify_beat_best_case = tmp2[tmp2.size() - group.num_qualifying];
550 // print out the lines we can attain
551 if (player.total + max_score_this_song > lead_beat && (lead_beat != win_beat)) {
552 int lead_need = std::max(lead_beat - player.total + 1, 0U);
555 text = widestring("Needs to lead: ") + widestring(pqxx::to_string(lead_need));
556 this_width = my_draw_text(text, NULL, 18.0, "need");
557 my_draw_text(text, buf, 18.0, "need", (LOGICAL_SCREEN_WIDTH/2) - this_width/2, y);
563 if (player.total + max_score_this_song > win_beat) {
564 int win_need = std::max(win_beat - player.total + 1, 0U);
567 text = widestring("Needs to win: ") + widestring(pqxx::to_string(win_need));
569 this_width = my_draw_text(text, NULL, 18.0, "need");
570 my_draw_text(text, buf, 18.0, "need", (LOGICAL_SCREEN_WIDTH/2) - this_width/2, y);
576 if (group.num_qualifying > 0 &&
577 group.num_qualifying != group.players.size() &&
578 player.total + max_score_this_song > unsigned(qualify_beat_worst_case) &&
579 (unsigned(qualify_beat_worst_case) != win_beat)) {
580 int qual_need = std::max(qualify_beat_worst_case - player.total + 1, 0U);
583 if (qualify_beat_worst_case == qualify_beat_best_case) {
584 text = widestring("Needs to qualify: ") + widestring(pqxx::to_string(qual_need));
586 text = widestring("Needs to secure qualification: ") + widestring(pqxx::to_string(qual_need));
589 this_width = my_draw_text(text, NULL, 18.0, "need");
590 my_draw_text(text, buf, 18.0, "need", (LOGICAL_SCREEN_WIDTH/2) - this_width/2, y);
598 // some refactoring done, more should be
599 void GroupScreen::draw(unsigned char *buf, unsigned width, unsigned height)
601 std::vector<TextDefer> td;
603 scores_changed.reset_flag();
604 set_screen_size(width, height);
607 * We'll probably need some values from here later on (although not all), just fetch them
608 * all while we're at it.
610 std::map<unsigned, unsigned> song_scores, player_scores;
611 conn.perform(FetchMaxScoreForSongs(tournament, &song_scores));
612 conn.perform(FetchMaxScoreForPlayers(tournament, round, &player_scores));
615 conn.perform(FetchGroup(tournament, round, parallel, &group));
616 gettimeofday(&last_updated, NULL);
618 fill_background(buf, width, height);
620 std::vector<unsigned> colwidth;
622 draw_main_heading(td);
623 find_column_widths(group, colwidth);
624 draw_column_headings(td, group, colwidth);
626 // Find out which player is next. we want to show SHOW_PLAYERS players, centered
627 // around this as much as possible. (Usually, this will mean all, but not always.)
628 unsigned show_players = get_show_players(group);
629 const Player *center_player = get_next_player(group);
631 // find the index (kind of backwards...)
632 int player_index = -1;
633 for (unsigned i = 0; i < group.players.size(); ++i) {
634 if (&(group.players[i]) == center_player) {
640 assert(player_index >= 0);
642 int min_player = player_index - signed(show_players) / 2;
643 if (min_player + show_players > group.players.size()) // FIXME: songs_per_machine
644 min_player = group.players.size() - show_players;
648 draw_scores(td, group, min_player, colwidth);
650 unsigned num_scores = group.players[0].scores.size();
653 * Approximate (but probably working quite well in practice) heuristic
654 * for finding the min and max rank of a player works as follows:
656 * First of all, find out, for each player in the group, what the
657 * maximum remaining score possibly can be (the minimum score is of
658 * course identical to the player's current total). For a random song,
659 * this is of course 1000 * (maximum feet rating) (but of course, that
660 * depends on whether we can play single or double! for now, assume
661 * double is okay, but this logic will be deferred to FetchMaxScore
662 * anyhow); for a random song, we simply pick the highest-ranking song
663 * we can find, EXCEPT those the player has chosen earlier AND the
664 * random songs this round, AND all random songs from elimination rounds
665 * (ie. rounds with only one group). (Phew!) This doesn't solve problems
666 * we'd face with more than one chosen song, but it should be good enough.
668 * After we've found the max and min scores for all players, it's a simple
669 * matter of sorting; the best attainable rank for player X is obtained if
670 * X gets max score and all others get min score, the worst attainable rank
671 * is obtained if X gets min score and all others get max score.
673 std::vector<unsigned> max_score, min_score;
674 for (std::vector<Player>::const_iterator i = group.players.begin(); i != group.players.end(); ++i) {
675 unsigned min_score_tp = 0, max_score_tp = 0;
676 for (std::vector<Score>::const_iterator j = i->scores.begin(); j != i->scores.end(); ++j) {
677 if (j->score != -1) {
679 min_score_tp += j->score;
680 max_score_tp += j->score;
682 unsigned max_score_this_song;
683 if (j->song.id != -1) {
684 // random song, or we know what song the player picked
685 max_score_this_song = song_scores[j->song.id];
687 max_score_this_song = player_scores[i->id];
689 max_score_tp += max_score_this_song;
692 max_score.push_back(max_score_tp);
693 min_score.push_back(min_score_tp);
696 // now finally find min and max rank, and draw it all
697 unsigned y = (show_players <= 7) ? 140 : (140 - (show_players - 7) * 5);
699 for (unsigned i = 0; i < group.players.size() && (i/num_machines) < show_players+min_player; ++i) {
700 unsigned best_rank = 1, worst_rank = 1;
701 for (unsigned j = 0; j < group.players.size(); ++j) {
705 if (max_score[i] < min_score[j])
707 if (min_score[i] <= max_score[j])
712 if (best_rank == worst_rank)
713 std::sprintf(text, "%u", best_rank);
715 std::sprintf(text, "%u-%u", best_rank, worst_rank);
717 if (i % num_machines != machine)
719 if (signed(i) < min_player)
722 std::string suffix = theme_suffix_from_row(row);
724 // find out where to place this
725 unsigned x = 40 + colwidth[0];
726 for (unsigned j = 1; j <= num_scores + 1; ++j)
727 x += colwidth[j] + 20;
729 // minor correction :-)
733 unsigned this_width = my_draw_text(text, NULL, 22.0, "rank" + suffix);
734 my_draw_text_deferred(td, text, 22.0, "rank" + suffix, "freshrank" + suffix, x + colwidth[num_scores + 2] / 2 - this_width / 2, y);
736 if (show_players > 7)
737 y += 40 - (show_players - 7) * 4;
744 if (players_per_machine == 2)
745 draw_next_up_versus(buf, group, song_scores, player_scores, max_score, min_score);
747 draw_next_up_single(buf, group, song_scores, player_scores, max_score, min_score);
750 draw_all_deferred_text(buf, td, last_text);
754 int GroupScreen::get_priority()