aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-06-16 10:17:37 +0100
committerBen Harris <bjh21@bjh21.me.uk>2023-06-16 10:17:37 +0100
commit2be0e4a242421840b2a36d18f6a4193e4fc67432 (patch)
treec3fbde01e7f62597eecc047ccbbd63ab8632cb84
parent5fb94c9f4712bdfa82ef438a4f166540daf3d156 (diff)
downloadpuzzles-2be0e4a242421840b2a36d18f6a4193e4fc67432.zip
puzzles-2be0e4a242421840b2a36d18f6a4193e4fc67432.tar.gz
puzzles-2be0e4a242421840b2a36d18f6a4193e4fc67432.tar.bz2
puzzles-2be0e4a242421840b2a36d18f6a4193e4fc67432.tar.xz
Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Pearl
-rw-r--r--pearl.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/pearl.c b/pearl.c
index efa3fa2..34abf2a 100644
--- a/pearl.c
+++ b/pearl.c
@@ -2175,7 +2175,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
if (!INGRID(state, gx, gy)) {
ui->ndragcoords = -1;
- return NULL;
+ return MOVE_UNUSED;
}
ui->clickx = x; ui->clicky = y;
@@ -2197,7 +2197,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
ui->cursor_active = true;
} else if (control || shift) {
char *move;
- if (ui->ndragcoords > 0) return NULL;
+ if (ui->ndragcoords > 0) return MOVE_NO_EFFECT;
ui->ndragcoords = -1;
move = mark_in_direction(state, ui->curx, ui->cury,
KEY_DIRECTION(button), control, tmpbuf);
@@ -2224,15 +2224,21 @@ static char *interpret_move(const game_state *state, game_ui *ui,
ui->clicky = CENTERED_COORD(ui->cury);
return MOVE_UI_UPDATE;
} else release = true;
- } else if (button == CURSOR_SELECT2 && ui->ndragcoords >= 0) {
- ui->ndragcoords = -1;
- return MOVE_UI_UPDATE;
- }
+ } else if (button == CURSOR_SELECT2) {
+ if (ui->ndragcoords >= 0) {
+ ui->ndragcoords = -1;
+ return MOVE_UI_UPDATE;
+ }
+ return MOVE_NO_EFFECT;
+ }
}
- if ((button == 27 || button == '\b') && ui->ndragcoords >= 0) {
- ui->ndragcoords = -1;
- return MOVE_UI_UPDATE;
+ if (button == 27 || button == '\b') {
+ if (ui->ndragcoords >= 0) {
+ ui->ndragcoords = -1;
+ return MOVE_UI_UPDATE;
+ }
+ return MOVE_NO_EFFECT;
}
if (release) {
@@ -2309,7 +2315,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
if (button == 'H' || button == 'h')
return dupstr("H");
- return NULL;
+ return MOVE_UNUSED;
}
static game_state *execute_move(const game_state *state, const char *move)