- /* Find the first player with the fewest songs played and part of this machine. */
- unsigned min_played_songs = 9999, num_random_songs = 0;
- const Player *next_player = NULL;
- unsigned m = 0;
- for (std::vector<Player>::const_iterator i = group.players.begin(); i != group.players.end(); ++i) {
- unsigned this_played = 0, this_random_songs = 0;
- for (std::vector<Score>::const_iterator j = i->scores.begin(); j != i->scores.end(); ++j) {
- if (j->score != -1)
- ++this_played;
- if (!j->chosen)
- ++this_random_songs;
- }
-
- if ((m++ % num_machines == machine) && this_played < min_played_songs) {
- min_played_songs = this_played;
- next_player = &(*i);
- num_random_songs = this_random_songs; // should be equal for all
- }
+ // Find out how many random songs there are (equal for all players).
+ unsigned num_random_songs = 0;
+ for (std::vector<Score>::const_iterator i = group.players[0].scores.begin(); i != group.players[0].scores.end(); ++i) {
+ if (!i->chosen)
+ ++num_random_songs;