]> git.cworth.org Git - grrobot/blobdiff - src/grrobot.c
Fixed select handling. Added two of Richard's fancy logos.
[grrobot] / src / grrobot.c
index a9a9d1e2a00a33e874e488ec6888410824cfdca4..b27fd5054a02b4ea7d129bfe00822f0a7d32c335 100644 (file)
@@ -1,4 +1,4 @@
-/* grrobot - Ricochet Robot using GTK+ and Xr
+/* grrobot - Ricochet Robot using GTK+, libxsvg, and Cairo
  *
  * Copyright © 2003 Carl Worth
  *
@@ -106,6 +106,8 @@ main (int argc, char **argv)
        }
        game.client = NULL;
     } else {
+       GPollFD *poll_fd;
+
        game.client = rr_client_create (args.host, args.port, args.user);
        if (game.client == NULL) {
            fprintf (stderr, "Failed connecting to %s:%s as %s\n",
@@ -131,6 +133,11 @@ main (int argc, char **argv)
        game.last_move_robot = RR_ROBOT_NONE;
 
        source = grr_game_notices_source_new (&game);
+       poll_fd = g_new (GPollFD, 1);
+       poll_fd->fd = rr_client_fd (game.client);
+       poll_fd->events = G_IO_IN;
+       g_source_add_poll (source, poll_fd);
+
        g_source_set_priority (source, GDK_PRIORITY_EVENTS);
        g_source_attach (source, NULL);
        g_source_unref (source);
@@ -332,7 +339,7 @@ grr_game_read_notices (grr_game_t *game)
            break;
        case RR_NOTICE_ACTIVE:
            grr_game_printf (game, "\nUser %s now active to demonstrate solution in %d moves.",
-                              notice->u.bid.username,
+                            notice->u.bid.username,
                             notice->u.bid.number);
            break;
        case RR_NOTICE_TIMER:
@@ -340,10 +347,16 @@ grr_game_read_notices (grr_game_t *game)
                             notice->u.number);
            break;
        case RR_NOTICE_POSITION:
+       {
+           int x, y;
+           rr_board_find_robot (board, notice->u.position.robot, &x, &y);
            rr_board_add_robot (board, notice->u.position.robot,
                                notice->u.position.x, notice->u.position.y);
-           gtk_widget_queue_draw (GTK_WIDGET (game->window));
-           break;
+           grr_board_view_mark_damage (game->board_view, x, y);
+           grr_board_view_mark_damage (game->board_view,
+                                       notice->u.position.x, notice->u.position.y);
+       }
+       break;
        default:
            fprintf (stderr, "Unknown notice: %d\n", notice->type);
            break;