aboutsummaryrefslogtreecommitdiff
path: root/samegame.c
diff options
context:
space:
mode:
Diffstat (limited to 'samegame.c')
-rw-r--r--samegame.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/samegame.c b/samegame.c
index 481154e..30550e1 100644
--- a/samegame.c
+++ b/samegame.c
@@ -1285,13 +1285,9 @@ static char *interpret_move(const game_state *state, game_ui *ui,
ui->displaysel = false;
tx = FROMCOORD(x); ty= FROMCOORD(y);
} else if (IS_CURSOR_MOVE(button)) {
- int dx = 0, dy = 0;
- ui->displaysel = true;
- dx = (button == CURSOR_LEFT) ? -1 : ((button == CURSOR_RIGHT) ? +1 : 0);
- dy = (button == CURSOR_DOWN) ? +1 : ((button == CURSOR_UP) ? -1 : 0);
- ui->xsel = (ui->xsel + state->params.w + dx) % state->params.w;
- ui->ysel = (ui->ysel + state->params.h + dy) % state->params.h;
- return ret;
+ return move_cursor(button, &ui->xsel, &ui->ysel,
+ state->params.w, state->params.h,
+ true, &ui->displaysel);
} else if (IS_CURSOR_SELECT(button)) {
ui->displaysel = true;
tx = ui->xsel;