diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-06-04 17:51:49 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-06-04 17:51:49 +0000 |
| commit | 57b3982c83694eb61dd97762ecfb3d53eeabf4f4 (patch) | |
| tree | 32c77ed3781be3e6869f4f6cbf9d3b93b2543516 /mines.c | |
| parent | 852bddabbb2bc94c83cff0a6e4dd91a915e3a0a8 (diff) | |
| download | puzzles-57b3982c83694eb61dd97762ecfb3d53eeabf4f4.zip puzzles-57b3982c83694eb61dd97762ecfb3d53eeabf4f4.tar.gz puzzles-57b3982c83694eb61dd97762ecfb3d53eeabf4f4.tar.bz2 puzzles-57b3982c83694eb61dd97762ecfb3d53eeabf4f4.tar.xz | |
Small UI bug: LEFT_RELEASEs were being thrown away completely if
their coordinates were outside the playing area. Clearly no actual
move should be made in that situation, but we do at least need to
sort out any highlighted squares from the prior dragging operations.
[originally from svn r5911]
Diffstat (limited to 'mines.c')
| -rw-r--r-- | mines.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -2490,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. @@ -2506,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 @@ -2532,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 |