aboutsummaryrefslogtreecommitdiff
path: root/flood.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-08-09 20:34:50 +0100
committerBen Harris <bjh21@bjh21.me.uk>2023-08-13 16:44:24 +0100
commit2b6c6dce34b9867fd18faed4ca9be6caf4e45bf5 (patch)
tree0d9c97eb9146a53ed2090723ea335a6303a528a1 /flood.c
parentdf31bc7a515a56b2322a097bda8f1aa510a7b9da (diff)
downloadpuzzles-2b6c6dce34b9867fd18faed4ca9be6caf4e45bf5.zip
puzzles-2b6c6dce34b9867fd18faed4ca9be6caf4e45bf5.tar.gz
puzzles-2b6c6dce34b9867fd18faed4ca9be6caf4e45bf5.tar.bz2
puzzles-2b6c6dce34b9867fd18faed4ca9be6caf4e45bf5.tar.xz
Flood: use move_cursor() for cursor movement
Diffstat (limited to 'flood.c')
-rw-r--r--flood.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/flood.c b/flood.c
index 390f98f..c6effeb 100644
--- a/flood.c
+++ b/flood.c
@@ -835,22 +835,9 @@ static char *interpret_move(const game_state *state, game_ui *ui,
tx = FROMCOORD(x);
ty = FROMCOORD(y);
ui->cursor_visible = false;
- } else if (button == CURSOR_LEFT && ui->cx > 0) {
- ui->cx--;
- ui->cursor_visible = true;
- return MOVE_UI_UPDATE;
- } else if (button == CURSOR_RIGHT && ui->cx+1 < w) {
- ui->cx++;
- ui->cursor_visible = true;
- return MOVE_UI_UPDATE;
- } else if (button == CURSOR_UP && ui->cy > 0) {
- ui->cy--;
- ui->cursor_visible = true;
- return MOVE_UI_UPDATE;
- } else if (button == CURSOR_DOWN && ui->cy+1 < h) {
- ui->cy++;
- ui->cursor_visible = true;
- return MOVE_UI_UPDATE;
+ } else if (IS_CURSOR_MOVE(button)) {
+ return move_cursor(button, &ui->cx, &ui->cy, w, h, false,
+ &ui->cursor_visible);
} else if (button == CURSOR_SELECT) {
tx = ui->cx;
ty = ui->cy;