From: Carl Worth Date: Fri, 29 Feb 2008 05:17:46 +0000 (-0800) Subject: Ignore clicks outside the current board X-Git-Url: https://git.cworth.org/git?p=loa;a=commitdiff_plain;h=bd9dff8fe6846704fecbc1f35018026cee638d37 Ignore clicks outside the current board This prevents crashing and moving pieces off of the board. --- diff --git a/loa.c b/loa.c index 5716a36..355c667 100644 --- a/loa.c +++ b/loa.c @@ -80,6 +80,13 @@ on_button_press_event (GtkWidget *widget, return TRUE; } + /* Do nothing for out-of-bounds clicks */ + if (x < 0 || x >= LOA_BOARD_SIZE || + y < 0 || y >= LOA_BOARD_SIZE) + { + return TRUE; + } + if (x == game->selected_x && y == game->selected_y) {