// titles for chosen songs.
unsigned width[16], num_scores;
unsigned max_num_width = my_draw_text("8888", NULL, 22.0);
- unsigned mode;
+ unsigned mode, sumwidth;
for (mode = 0; mode < 2; ++mode) {
for (unsigned i = 0; i < 16; ++i)
width[i] = 0;
width[num_scores + 2] = my_draw_text("Rank", NULL, 12.0);
// if we're at long titles and that works, don't try the short ones
- if (mode == 0) {
- unsigned sumwidth = 0;
- for (unsigned i = 0; i <= num_scores + 2; ++i)
- sumwidth += width[i] + 20;
+ sumwidth = 0;
- if (sumwidth < 800)
+ for (unsigned i = 0; i <= num_scores + 2; ++i)
+ sumwidth += width[i] + 20;
+
+ if (sumwidth < 780)
+ break;
+ }
+
+ /*
+ * If we have space to go, distribute as much as we can to the chosen song column, so we won't have
+ * total and rank jumping around.
+ */
+ if (sumwidth < 780) {
+ int first_chosen_col = -1;
+ unsigned col = 1;
+
+ for (std::vector<Score>::const_iterator i = group.players[0].scores.begin(); i != group.players[0].scores.end(); ++i, ++col) {
+ if (i->chosen) {
+ first_chosen_col = col;
break;
+ }
+ }
+
+ if (first_chosen_col != -1) {
+ printf("first_chosen_col=%u\n", first_chosen_col);
+ width[first_chosen_col] += 780 - sumwidth;
}
}