Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Mines

This commit is contained in:
Ben Harris
2023-06-05 22:56:11 +01:00
parent a943f3177f
commit 87e98e6715

15
mines.c
View File

@ -2437,7 +2437,7 @@ static char *interpret_move(const game_state *from, game_ui *ui,
if (button == CURSOR_SELECT2) {
/* As for RIGHT_BUTTON; only works on covered square. */
if (v != -2 && v != -1)
return NULL;
return MOVE_NO_EFFECT;
sprintf(buf, "F%d,%d", ui->cur_x, ui->cur_y);
return dupstr(buf);
}
@ -2458,7 +2458,7 @@ static char *interpret_move(const game_state *from, game_ui *ui,
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;
return MOVE_UNUSED;
/*
* Mouse-downs and mouse-drags just cause highlighting
@ -2477,7 +2477,7 @@ static char *interpret_move(const game_state *from, game_ui *ui,
if (button == RIGHT_BUTTON) {
if (cx < 0 || cx >= from->w || cy < 0 || cy >= from->h)
return NULL;
return MOVE_UNUSED;
/*
* Right-clicking only works on a covered square, and it
@ -2488,7 +2488,7 @@ static char *interpret_move(const game_state *from, game_ui *ui,
*/
if (from->grid[cy * from->w + cx] != -2 &&
from->grid[cy * from->w + cx] != -1)
return NULL;
return MOVE_NO_EFFECT;
sprintf(buf, "F%d,%d", cx, cy);
return dupstr(buf);
@ -2499,8 +2499,9 @@ static char *interpret_move(const game_state *from, game_ui *ui,
ui->hradius = 0;
/*
* At this stage we must never return NULL: we have adjusted
* the ui, so at worst we return MOVE_UI_UPDATE.
* At this stage we must never return MOVE_UNUSED or
* MOVE_NO_EFFECT: we have adjusted the ui, so at worst we
* return MOVE_UI_UPDATE.
*/
if (cx < 0 || cx >= from->w || cy < 0 || cy >= from->h)
return MOVE_UI_UPDATE;
@ -2523,7 +2524,7 @@ static char *interpret_move(const game_state *from, game_ui *ui,
}
goto uncover;
}
return NULL;
return MOVE_UNUSED;
uncover:
{