summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
74df249)
An actual button would be better, but I'm being lazy as far
as real UI again.
board->player = DVONN_PLAYER_BLACK;
}
board->player = DVONN_PLAYER_BLACK;
}
+int
+dvonn_board_pass (dvonn_board_t *board)
+{
+ /* XXX: Should check here and only allow a pass if there are
+ * no legal moves. */
+
+ dvonn_board_next_player (board);
+
+ return TRUE;
+}
+
int
dvonn_board_place (dvonn_board_t *board,
int x, int y,
int
dvonn_board_place (dvonn_board_t *board,
int x, int y,
int x2, int y2,
char **error);
int x2, int y2,
char **error);
+/* Pass rather than moving, allowing the turn to pass to the
+ * opponent. This should only be allowed if there are no legal moves,
+ * but that is not yet enforced. Returns TRUE if the pass succeeds. */
+int
+dvonn_board_pass (dvonn_board_t *board);
+
/* Is the cell at (x,y) occupied by a piece. Returns FALSE for all
* out-of-bounds coordinates. */
dvonn_bool_t
/* Is the cell at (x,y) occupied by a piece. Returns FALSE for all
* out-of-bounds coordinates. */
dvonn_bool_t
if (event->type >= GDK_2BUTTON_PRESS)
return TRUE;
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);
x = event->x;
y = event->y;
layout_device_to_board (layout, &x, &y);