-/* grrobot - Ricochet Robot using GTK+ and Xr
+/* grrobot - Ricochet Robot using GTK+, libxsvg, and Cairo
*
* Copyright © 2003 Carl Worth
*
}
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",
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);
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:
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;