]> git.sesse.net Git - ccbs/blobdiff - bigscreen/top10scorescreen.cpp
Implement a simple priority system.
[ccbs] / bigscreen / top10scorescreen.cpp
index 791c785ec61b4fc0fd30bb5db1bc39a2c6cd809f..6ae58fd1d9d5c7b970253e9dc20be79a29434678 100644 (file)
@@ -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<TopScore> scores;
+       conn.perform(FetchTopScoresForTournament(tournament, 10, &scores));
+       
+       for (std::vector<TopScore>::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)
@@ -77,3 +87,7 @@ void Top10ScoreScreen::draw(unsigned char *buf)
        std::copy(scores.begin(), scores.end(), std::inserter(seen_topscore, seen_topscore.end()));
 }
 
+int Top10ScoreScreen::get_priority()
+{
+       return 5;
+}