From: Steinar H. Gunderson Date: Mon, 28 Feb 2005 18:12:46 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=914b810749b54bb07e1944e558015d6c8f615528 --- diff --git a/bigscreen/groupscreen.cpp b/bigscreen/groupscreen.cpp index 1a07234..d0370de 100644 --- a/bigscreen/groupscreen.cpp +++ b/bigscreen/groupscreen.cpp @@ -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; + } } } } diff --git a/html/do-set-active-round.pl b/html/do-set-active-round.pl index c98a478..00393ac 100755 --- a/html/do-set-active-round.pl +++ b/html/do-set-active-round.pl @@ -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); } diff --git a/sql/ccbs.sql b/sql/ccbs.sql index 9f0cdea..6cd5154 100644 --- a/sql/ccbs.sql +++ b/sql/ccbs.sql @@ -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 ),