From 2b6c6dce34b9867fd18faed4ca9be6caf4e45bf5 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 9 Aug 2023 20:34:50 +0100 Subject: [PATCH] Flood: use move_cursor() for cursor movement --- flood.c | 19 +++---------------- 1 file 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;