X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/f17c2cda3b8ae5c8889529d53f95f14521c7f102..39c86385a35e8ae4c2eb5487464787d6fb15a782:/mines.c?ds=sidebyside diff --git a/mines.c b/mines.c index df8ecfa..4b9620e 100644 --- a/mines.c +++ b/mines.c @@ -97,8 +97,11 @@ static game_params *default_params(void) static const struct game_params mines_presets[] = { {9, 9, 10, TRUE}, + {9, 9, 35, TRUE}, {16, 16, 40, TRUE}, + {16, 16, 99, TRUE}, {30, 16, 99, TRUE}, + {30, 16, 170, TRUE}, }; static int game_fetch_preset(int i, char **name, game_params **params) @@ -2487,11 +2490,12 @@ static game_state *make_move(game_state *from, game_ui *ui, game_drawstate *ds, cx = FROMCOORD(x); cy = FROMCOORD(y); - if (cx < 0 || cx >= from->w || cy < 0 || cy >= from->h) - return NULL; if (button == LEFT_BUTTON || button == LEFT_DRAG || button == MIDDLE_BUTTON || button == MIDDLE_DRAG) { + if (cx < 0 || cx >= from->w || cy < 0 || cy >= from->h) + return NULL; + /* * Mouse-downs and mouse-drags just cause highlighting * updates. @@ -2503,6 +2507,9 @@ static game_state *make_move(game_state *from, game_ui *ui, game_drawstate *ds, } if (button == RIGHT_BUTTON) { + if (cx < 0 || cx >= from->w || cy < 0 || cy >= from->h) + return NULL; + /* * Right-clicking only works on a covered square, and it * toggles between -1 (marked as mine) and -2 (not marked @@ -2529,6 +2536,8 @@ static game_state *make_move(game_state *from, game_ui *ui, game_drawstate *ds, * At this stage we must never return NULL: we have adjusted * the ui, so at worst we return `from'. */ + if (cx < 0 || cx >= from->w || cy < 0 || cy >= from->h) + return from; /* * Left-clicking on a covered square opens a tile. Not