From 20ae0a7a65bf59852d1fb580ff7f8c850799db0e Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 5 Mar 2005 01:05:57 +0000 Subject: [PATCH 1/1] Fixed "number of played songs" detection for bigscreen, making the "needs to lead" etc. work again. --- bigscreen/groupscreen.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bigscreen/groupscreen.cpp b/bigscreen/groupscreen.cpp index d163069..0fc28c0 100644 --- a/bigscreen/groupscreen.cpp +++ b/bigscreen/groupscreen.cpp @@ -276,15 +276,12 @@ void GroupScreen::draw_next_up_single(unsigned char *buf, const Group &group, */ const Player *next_player = get_next_player(group); const Score *next_song = NULL; - unsigned num_played = 0; // will not always be completely accurate, but always as accurate as we need it :-) for (unsigned i = 0; i < num_random_songs; ++i) { unsigned j = (i + next_player->position - 1) % num_random_songs; if (next_player->scores[j].score == -1) { next_song = &(next_player->scores[j]); break; - } else { - ++num_played; } } @@ -295,13 +292,19 @@ void GroupScreen::draw_next_up_single(unsigned char *buf, const Group &group, if (next_player->scores[j].score == -1) { next_song = &(next_player->scores[j]); break; - } else { - ++num_played; } } } if (next_song != NULL) { + // find out how many songs we've played in all + unsigned num_played = 0; + for (unsigned i = 0; i < num_scores; ++i) { + if (next_player->scores[i].score != -1) { + ++num_played; + } + } + bool last_song = (num_played == num_scores - 1); draw_next_up_player(buf, group, *next_player, *next_song, last_song, song_scores, player_scores, max_score, min_score); -- 2.39.2