aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;