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.
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5911
cda61777-01e9-0310-a592-
d414129be87e
cx = FROMCOORD(x);
cy = FROMCOORD(y);
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 (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.
/*
* Mouse-downs and mouse-drags just cause highlighting
* updates.
}
if (button == RIGHT_BUTTON) {
}
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
/*
* Right-clicking only works on a covered square, and it
* toggles between -1 (marked as mine) and -2 (not marked
* At this stage we must never return NULL: we have adjusted
* the ui, so at worst we return `from'.
*/
* 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
/*
* Left-clicking on a covered square opens a tile. Not