Various changes and fixes for CC1.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 23 Apr 2005 17:41:08 +0000 (17:41 +0000)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 23 Apr 2005 17:41:08 +0000 (17:41 +0000)
bigscreen/Makefile
bigscreen/ccbs_bigscreen.cpp
bigscreen/fetch_top_scores_for_tournament.cpp
bigscreen/groupscreen.cpp
bigscreen/resolution.h
bigscreen/tinyptc/test.c
bigscreen/tinyptc/tinyptc.h
html/ccbs.pm

index d58b48e..e95b4af 100644 (file)
@@ -1,9 +1,9 @@
 CC=gcc
 CXX=g++
 CPPFLAGS=-I/usr/include/postgresql $(shell freetype-config --cflags) -Itinyptc/
-CXXFLAGS=-g -Wall
+CXXFLAGS=-O2 -Wall
 LDFLAGS=-L/usr/X11R6/lib
-LIBS=$(shell freetype-config --libs) $(shell libpq3-config) -lpqxx tinyptc/libtinyptc.a -lX11 -lXext
+LIBS=$(shell freetype-config --libs) $(shell libpq3-config) -lpqxx tinyptc/libtinyptc.a -lX11 -lXext -lXxf86vm -lXxf86dga
 
 CCBS_BIGSCREEN_SQL_OBJS=fetch_current_tournament.o fetch_list_of_active_groups.o \
        fetch_list_of_finished_groups.o \
index 8e65990..b32c5b1 100644 (file)
@@ -27,7 +27,7 @@ unsigned char framebuf[SCREEN_WIDTH * SCREEN_HEIGHT * 4], screenbuf[SCREEN_WIDTH
 void init(pqxx::connection &conn)
 {
        std::vector<widestring> aux_screens;
-               
+       
        if (screens.size() == 0 || mainscreen != screens[0])
                delete mainscreen;
        
@@ -36,6 +36,9 @@ void init(pqxx::connection &conn)
        }
        screens.erase(screens.begin(), screens.end());
 
+       RotateScreen *rs = new RotateScreen();
+       mainscreen = rs;
+       
        conn.perform(FetchCurrentTournament(&active_tournament));
        conn.perform(FetchListOfActiveGroups(&active_groups));
 
@@ -50,60 +53,23 @@ void init(pqxx::connection &conn)
 
                        // memory leaks here?
                        for (unsigned j = 0; j < i->num_machines; ++j) {
-                               RotateScreen *rs = new RotateScreen();
-                               screens.push_back(rs);
                                rs->add_screen(new GroupScreen(conn, i->tournament, i->round, i->parallel, j, i->num_machines, i->players_per_machine));
                        }
                }
        }
 
-       // show auxilliary screens if we have zero, two or three other screens going
-       if (screens.size() < 4 && screens.size() != 1) {
-               RotateScreen *aux_screen = new RotateScreen();
-               screens.push_back(aux_screen);
-               
+       {
                conn.perform(FetchAuxilliaryScreens(&aux_screens));
                for (std::vector<widestring>::const_iterator i = aux_screens.begin(); i != aux_screens.end(); ++i) {
                        if (*i == widestring("top10scores")) {
-                               aux_screen->add_screen(new Top10ScoreScreen(conn, active_tournament.id));
+                               rs->add_screen(new Top10ScoreScreen(conn, active_tournament.id));
                                continue;
                        }
                        if (*i == widestring("top5chosen")) {
-                               aux_screen->add_screen(new Top5ChosenScreen(conn, active_tournament.id));
+                               rs->add_screen(new Top5ChosenScreen(conn, active_tournament.id));
                                continue;
                        }
-                       std::fprintf(stderr, "Foobarbaz?\n");
-               }
-
-               /*
-                * If we still have room, make yet another rotational screen with
-                * results from previous groups -- otherwise tack them onto the end
-                * of the auxilliary screens.
-                */
-               RotateScreen *finished_groups_screen = aux_screen;
-               if (screens.size() < 4 && screens.size() != 1) {
-                       finished_groups_screen = new RotateScreen();
-                       screens.push_back(finished_groups_screen);
                }
-                       
-               std::vector<SkeletonGroup> finished_groups;
-               conn.perform(FetchListOfFinishedGroups(active_tournament.id, &finished_groups));
-                       
-               for (std::vector<SkeletonGroup>::const_iterator i = finished_groups.begin(); i != finished_groups.end(); ++i) {
-                       finished_groups_screen->add_screen(new GroupScreen(conn, i->tournament, i->round, i->parallel, 0, 1, 1));
-               }
-       }
-       
-       // hack
-       screens.push_back(NULL);
-       screens.push_back(NULL);
-       screens.push_back(NULL);
-       screens.push_back(NULL);
-
-       if (screens[1] == NULL) {
-               mainscreen = screens[0];
-       } else {
-               mainscreen = new SplitScreen(screens[0], screens[1], screens[2], screens[3]);
        }
 }
 
@@ -131,7 +97,7 @@ int main(int argc, char **argv)
        
        try {
                init_freetype();
-               pqxx::connection conn("dbname=ccbs host=altersex.samfundet.no user=ccbs password=GeT|>>B_");
+               pqxx::connection conn("dbname=ccbs host=www.positivegaming.com user=ccbs password=GeT|>>B_");
                FlagTrigger tournament_changed(conn, "active_tournament");
                FlagTrigger rounds_changed(conn, "active_groups");
                
index 9c38f51..dd70331 100644 (file)
@@ -19,7 +19,7 @@ void FetchTopScoresForTournament::operator() (pqxx::transaction<> &t)
 
        // Again, this will break if a song has more than one short title
        pqxx::result res( t.exec(
-               "SELECT nick, title, shorttitle, score FROM scores NATURAL JOIN tournaments NATURAL JOIN players NATURAL JOIN songs NATURAL LEFT JOIN songshorttitles WHERE tournament=" +
+               "SELECT nick, title, shorttitle, score FROM scores NATURAL JOIN tournaments JOIN players ON scores.player=players.player NATURAL JOIN songs NATURAL LEFT JOIN songshorttitles WHERE tournament=" +
                        pqxx::to_string(tournament) + " AND score IS NOT NULL ORDER BY score DESC LIMIT " +
                        pqxx::to_string(num)) );
        
index 750cec4..c13c332 100644 (file)
@@ -194,9 +194,13 @@ void GroupScreen::find_column_widths(const Group &group, std::vector<unsigned> &
                        
                for (unsigned i = 0; i <= num_scores + 2; ++i)
                        sumcolwidth += colwidth[i] + 20;
-                       
+               
                if (sumcolwidth < 780)
                        break;
+
+               if (mode == 0) {
+                       colwidth.erase(colwidth.begin(), colwidth.end());
+               }
        }
 
        /* 
index a27b336..20125eb 100644 (file)
@@ -1,9 +1,9 @@
 #ifndef _RESOLUTION_H
 #define _RESOLUTION_H 1
 
-#define SCREEN_WIDTH 800
-#define SCREEN_HEIGHT 600
-#define SCREEN_LCD 1
+#define SCREEN_WIDTH 640
+#define SCREEN_HEIGHT 480
+#define SCREEN_LCD 0
 
 /*
  * This is used in the screens, mostly for historical reasons (they were
index cc6ccaf..2b28c70 100644 (file)
@@ -25,8 +25,8 @@
 
 #include <stdio.h>
 
-#define WIDTH 320
-#define HEIGHT 200
+#define WIDTH 800
+#define HEIGHT 600
 #define SIZE WIDTH*HEIGHT
 
 static int noise;
index a6cf0aa..cf2b621 100644 (file)
@@ -43,7 +43,7 @@ typedef unsigned char char8;
 
 /* This directive enables mmx-optimized pixelformat conversions */
 
-/* #define __PTC_MMX__ */
+#define __PTC_MMX__ 
 
 /* This directive enables little-endian pixelformat converters - ignored for
  * the XVideo+Mit-Shm target */
@@ -67,7 +67,7 @@ typedef unsigned char char8;
 /* If you uncomment this directive, you'll choose X Shared memory extension
  * video rendering */
 
-#define __PTC_XSHM__
+#define __PTC_XSHM__ 
 
 /* If you uncomment this directive, you'll choose X Double buffer extension
  * video rendering */
@@ -77,7 +77,7 @@ typedef unsigned char char8;
 /* If you uncomment this directive, you'll choose X Direct Graphics Access
  * extension (version 1.x) video rendering */
 
-/* #define __PTC_XDGA1__ */
+/* #define __PTC_XDGA1__  */
 
 /* If you uncomment this directive, you'll choose X Direct Graphics Access
  * extension (version 2.x) video rendering */
index 61dadf8..f5deada 100755 (executable)
@@ -25,14 +25,14 @@ sub print_see_other {
        my $location = shift;
 
        print CGI::header(-status=>'303 See other',
-                         -location=>'http://ccbs.sesse.net/' . $location,
+                         -location=>'http://192.168.1.200/' . $location,
                          -type=>'text/html; charset=utf-8');
 }
 
 sub db_connect {
        $ccbs_dbdebug = defined(shift) ? 1 : 0;
 
-       my $dbh = DBI->connect("dbi:Pg:dbname=ccbs;host=altersex.samfundet.no", "ccbs", "GeT|>>B_")
+       my $dbh = DBI->connect("dbi:Pg:dbname=ccbs;host=www.positivegaming.com", "ccbs", "GeT|>>B_")
                or die "Couldn't connect to database";
        $dbh->{RaiseError} = 1;
        return $dbh;