From 87e98e67158326a7dd94fd8fa255e3695898ecf3 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 5 Jun 2023 22:56:11 +0100 Subject: [PATCH] Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Mines --- mines.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mines.c b/mines.c index de82716..d1787f5 100644 --- a/mines.c +++ b/mines.c @@ -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: {