]> git.sesse.net Git - ccbs/commitdiff
(no commit message)
authorSteinar H. Gunderson <sesse@samfundet.no>
Mon, 28 Feb 2005 18:12:46 +0000 (18:12 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Mon, 28 Feb 2005 18:12:46 +0000 (18:12 +0000)
bigscreen/groupscreen.cpp
html/do-set-active-round.pl
sql/ccbs.sql

index 1a0723408211f6f983a8ca93fb6123d7328e7949..d0370de55c9514cc26e50a49625bc082e8f8674f 100644 (file)
@@ -165,7 +165,7 @@ void GroupScreen::draw(unsigned char *buf)
                                my_draw_text_deferred(td, text, 22.0, x + max_num_width - this_width, y);
 
                                // draw the long name if we can, otherwise use the short one
-                               if (my_draw_text(j->song.title, NULL, 12.0) > width[col]) {
+                               if (my_draw_text(j->song.title, NULL, 12.0) > (width[col] - 10 - max_num_width)) {
                                        my_draw_text_deferred(td, j->song.short_title, 12.0, x + max_num_width + 10, y);
                                } else {
                                        my_draw_text_deferred(td, j->song.title, 12.0, x + max_num_width + 10, y);
@@ -434,23 +434,27 @@ void GroupScreen::draw(unsigned char *buf)
                        // print out the lines we can attain
                        if (next_player->total + max_score_this_song > lead_beat && (lead_beat != win_beat)) {
                                int lead_need = std::max(lead_beat - next_player->total + 1, 0U);
-                               
-                               text = widestring("Needs to lead: ") + widestring(pqxx::to_string(lead_need));
-                               this_width = my_draw_text(text, NULL, 18.0);
-                               my_draw_text(text, buf, 18.0, 400 - this_width/2, y);
+                       
+                               if (lead_need > 0) {
+                                       text = widestring("Needs to lead: ") + widestring(pqxx::to_string(lead_need));
+                                       this_width = my_draw_text(text, NULL, 18.0);
+                                       my_draw_text(text, buf, 18.0, 400 - this_width/2, y);
 
-                               y += 30;
+                                       y += 30;
+                               }
                        }
                        
                        if (next_player->total + max_score_this_song > win_beat) {
                                int win_need = std::max(win_beat - next_player->total + 1, 0U);
                                
-                               text = widestring("Needs to win: ") + widestring(pqxx::to_string(win_need));
+                               if (win_need > 0) {
+                                       text = widestring("Needs to win: ") + widestring(pqxx::to_string(win_need));
 
-                               this_width = my_draw_text(text, NULL, 18.0);
-                               my_draw_text(text, buf, 18.0, 400 - this_width/2, y);
+                                       this_width = my_draw_text(text, NULL, 18.0);
+                                       my_draw_text(text, buf, 18.0, 400 - this_width/2, y);
 
-                               y += 30;
+                                       y += 30;
+                               }
                        }
 
                        if (group.num_qualifying > 0 &&
@@ -458,16 +462,18 @@ void GroupScreen::draw(unsigned char *buf)
                            (unsigned(qualify_beat_worst_case) != win_beat)) {
                                int qual_need = std::max(qualify_beat_worst_case - next_player->total + 1, 0U);
                                
-                               if (qualify_beat_worst_case == qualify_beat_best_case) {
-                                       text = widestring("Needs to qualify: ") + widestring(pqxx::to_string(qual_need));
-                               } else {
-                                       text = widestring("Needs to secure qualification: ") + widestring(pqxx::to_string(qual_need));
-                               }
+                               if (qual_need > 0) {
+                                       if (qualify_beat_worst_case == qualify_beat_best_case) {
+                                               text = widestring("Needs to qualify: ") + widestring(pqxx::to_string(qual_need));
+                                       } else {
+                                               text = widestring("Needs to secure qualification: ") + widestring(pqxx::to_string(qual_need));
+                                       }
+                                       
+                                       this_width = my_draw_text(text, NULL, 18.0);
+                                       my_draw_text(text, buf, 18.0, 400 - this_width/2, y);
                                
-                               this_width = my_draw_text(text, NULL, 18.0);
-                               my_draw_text(text, buf, 18.0, 400 - this_width/2, y);
-
-                               y += 30;
+                                       y += 30;
+                               }
                        }
                }
        }
index c98a478dc9a1320804cde5020167e50506fdcb58..00393ac62b970071a916c4702b633d2731533dfa 100755 (executable)
@@ -16,7 +16,7 @@ $dbh->{AutoCommit} = 0;
 $dbh->do('DELETE FROM bigscreen.active_groups WHERE tournament=? AND round=? AND parallel=?', undef,
        $tournament, $round, $parallel);
 if ($cgi->param('show') eq 'true') {
-       $dbh->do('INSERT INTO bigscreen.active_groups (tournament, round, parallel, last_updated) VALUES (?,?,?,now())',
+       $dbh->do('INSERT INTO bigscreen.active_groups (tournament, round, parallel, num_machines, last_updated) VALUES (?,?,?,1,now())',
                undef, $tournament, $round, $parallel);
 }
 
index 9f0cdeaa283e933da933674715dd187f51fb7e6d..6cd515465607f02f5f6f6f032379ba7041aa622f 100644 (file)
@@ -176,6 +176,7 @@ CREATE TABLE bigscreen.active_groups (
        tournament INTEGER NOT NULL REFERENCES bigscreen.active_tournament,
        round INTEGER NOT NULL,
        parallel INTEGER NOT NULL,
+       num_machines INTEGER NOT NULL,
        last_updated TIMESTAMP NOT NULL,
 
        PRIMARY KEY ( tournament, round, parallel ),