aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-08-09 14:32:31 +0100
committerBen Harris <bjh21@bjh21.me.uk>2023-08-09 14:32:31 +0100
commit7e9228f15472ed1d9a691ac9b41ae52436e10cdf (patch)
treeb75f4fabb21ed50577d9a862fcf27b7b4d784fd9
parent785de41a92dcd45a71c322bafa8af737bb1eb7aa (diff)
downloadpuzzles-7e9228f15472ed1d9a691ac9b41ae52436e10cdf.zip
puzzles-7e9228f15472ed1d9a691ac9b41ae52436e10cdf.tar.gz
puzzles-7e9228f15472ed1d9a691ac9b41ae52436e10cdf.tar.bz2
puzzles-7e9228f15472ed1d9a691ac9b41ae52436e10cdf.tar.xz
Use move_cursor() for cursor movement in Same Game
No significant behavioural change.
-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;