X-Git-Url: https://git.cworth.org/git?p=dvonn;a=blobdiff_plain;f=dvonn.c;h=c1762ed19be159f67832ce71fe032e85e0331ee0;hp=99cadf71d638af48d66f6fb8abf3bb3f9a29f21d;hb=HEAD;hpb=7e10cab22cd0cd20ff48bf5665f0f7536f1ad032 diff --git a/dvonn.c b/dvonn.c index 99cadf7..c1762ed 100644 --- a/dvonn.c +++ b/dvonn.c @@ -177,13 +177,6 @@ on_button_press_event (GtkWidget *widget, if (event->type >= GDK_2BUTTON_PRESS) return TRUE; - /* Right-click means pass, (yes, it would be better to add some - * actual UI elements... */ - if (event->button == 3) { - dvonn_board_pass (&game->board); - return TRUE; - } - x = event->x; y = event->y; layout_device_to_board (layout, &x, &y); @@ -229,7 +222,7 @@ on_button_press_event (GtkWidget *widget, dvonn_game_update_windows (game); return TRUE; } - + if (dvonn_board_move (&game->board, game->selected_x, game->selected_y, x, y, &error)) @@ -373,12 +366,39 @@ on_expose_event_draw (GtkWidget *widget, pango_font_description_set_family (game->font, DVONN_FONT); pango_font_description_set_absolute_size (game->font, DVONN_FONT_SIZE * PANGO_SCALE); } - to_move = _create_layout_printf (cr, game->font, - "%s to %s.", - game->board.player == DVONN_PLAYER_WHITE ? - "White" : "Black", - game->board.phase == DVONN_PHASE_PLACEMENT ? - "place" : "move"); + if (game->board.phase == DVONN_PHASE_GAME_OVER) { + if (game->board.score[DVONN_PLAYER_WHITE] > + game->board.score[DVONN_PLAYER_BLACK]) + { + to_move = _create_layout_printf (cr, game->font, + "White wins (%d to %d)\n", + game->board.score[DVONN_PLAYER_WHITE], + game->board.score[DVONN_PLAYER_BLACK]); + } + else if (game->board.score[DVONN_PLAYER_BLACK] > + game->board.score[DVONN_PLAYER_WHITE]) + { + to_move = _create_layout_printf (cr, game->font, + "Black wins (%d to %d)\n", + game->board.score[DVONN_PLAYER_BLACK], + game->board.score[DVONN_PLAYER_WHITE]); + } + else + { + to_move = _create_layout_printf (cr, game->font, + "Tie game (%d to %d)\n", + game->board.score[DVONN_PLAYER_WHITE], + game->board.score[DVONN_PLAYER_BLACK]); + + } + } else { + to_move = _create_layout_printf (cr, game->font, + "%s to %s.", + game->board.player == DVONN_PLAYER_WHITE ? + "White" : "Black", + game->board.phase == DVONN_PHASE_PLACEMENT ? + "place" : "move"); + } cairo_move_to (cr, 2, 2); if (game->board.player == DVONN_PLAYER_WHITE) cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);