From 5b91be5c8efa7c68e38134630c9894dd6484d72e Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 1 Mar 2005 00:51:32 +0000 Subject: [PATCH] Make the "top 10 scores" and "top 5 chosen songs" screens only say they're updated if there is actual new data. --- bigscreen/top10scorescreen.cpp | 12 +++++++++++- bigscreen/top5chosenscreen.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bigscreen/top10scorescreen.cpp b/bigscreen/top10scorescreen.cpp index 791c785..2db7bfd 100644 --- a/bigscreen/top10scorescreen.cpp +++ b/bigscreen/top10scorescreen.cpp @@ -20,7 +20,17 @@ bool Top10ScoreScreen::check_invalidated() if (!scores_changed.get_flag()) return false; - return true; + // check that there are indeed changes, otherwise don't bother + std::vector scores; + conn.perform(FetchTopScoresForTournament(tournament, 10, &scores)); + + for (std::vector::const_iterator i = scores.begin(); i != scores.end(); ++i) { + if (seen_topscore.count(*i) == 0) { + return true; + } + } + + return false; } void Top10ScoreScreen::draw(unsigned char *buf) diff --git a/bigscreen/top5chosenscreen.cpp b/bigscreen/top5chosenscreen.cpp index 1c4e495..cbb4455 100644 --- a/bigscreen/top5chosenscreen.cpp +++ b/bigscreen/top5chosenscreen.cpp @@ -20,7 +20,17 @@ bool Top5ChosenScreen::check_invalidated() if (!scores_changed.get_flag()) return false; - return true; + // check that there are indeed changes, otherwise don't bother + std::vector scores; + conn.perform(FetchTopChosenSongsForTournament(tournament, 5, &scores)); + + for (std::vector::const_iterator i = scores.begin(); i != scores.end(); ++i) { + if (seen_topchosen.count(*i) == 0) { + return true; + } + } + + return false; } void Top5ChosenScreen::draw(unsigned char *buf) -- 2.39.2