diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-06-16 10:17:37 +0100 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-06-16 10:17:37 +0100 |
| commit | 2be0e4a242421840b2a36d18f6a4193e4fc67432 (patch) | |
| tree | c3fbde01e7f62597eecc047ccbbd63ab8632cb84 | |
| parent | 5fb94c9f4712bdfa82ef438a4f166540daf3d156 (diff) | |
| download | puzzles-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.c | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -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) |