- virtual void operator() (int pid)
- {
- flag = true;
- std::fprintf(stderr, "Received a flag trigger from pid %u\n", pid);
+ for (std::vector<GenericScreen *>::const_iterator i = screens.begin(); i != screens.end(); ++i) {
+ delete *i;
+ }
+ screens.erase(screens.begin(), screens.end());
+
+#if !USE_SPLITSCREEN
+ RotateScreen *rs = new RotateScreen();
+ mainscreen = rs;
+#endif
+
+ conn.perform(FetchCurrentTournament(&active_tournament));
+ conn.perform(FetchListOfActiveGroups(&active_groups));
+
+ if (active_tournament.id == -1) {
+ std::fprintf(stderr, "No active tournament\n");
+ } else {
+ std::fprintf(stderr, "Current tournament is %d\n", active_tournament.id);
+
+ for (std::vector<SkeletonGroup>::const_iterator i = active_groups.begin(); i != active_groups.end(); ++i) {
+ std::fprintf(stderr, "tourn: %u round: %u parallel: %u num_machines: %u\n",
+ i->tournament, i->round, i->parallel, i->num_machines);
+
+ // memory leaks here?
+ for (unsigned j = 0; j < i->num_machines; ++j) {
+#if USE_SPLITSCREEN
+ RotateScreen *rs = new RotateScreen();
+ screens.push_back(rs);
+#endif
+ rs->add_screen(new GroupScreen(conn, i->tournament, i->round, i->parallel, j, i->num_machines, i->players_per_machine));
+ }
+ }