shithub: puzzles

Download patch

ref: 995bcef981c0495df3e43d1025339dc5991f92d9
parent: 4e724b25c276ec84ce5c95041c0cb3c0256fa388
author: Ben Harris <bjh21@bjh21.me.uk>
date: Wed Aug 9 19:24:39 EDT 2023

Galaxies: use new move_cursor() features

--- a/galaxies.c
+++ b/galaxies.c
@@ -3021,16 +3021,15 @@
 	else
 	    return MOVE_UI_UPDATE;
     } else if (IS_CURSOR_MOVE(button)) {
-        move_cursor(button, &ui->cur_x, &ui->cur_y, state->sx-1, state->sy-1,
-                    false, NULL);
-        if (ui->cur_x < 1) ui->cur_x = 1;
-        if (ui->cur_y < 1) ui->cur_y = 1;
-        ui->cur_visible = true;
+        int cx = ui->cur_x - 1, cy = ui->cur_y - 1;
+        char *ret = move_cursor(button, &cx, &cy, state->sx-2, state->sy-2,
+                                false, &ui->cur_visible);
+        ui->cur_x = cx + 1, ui->cur_y = cy + 1;
         if (ui->dragging) {
             ui->dx = SCOORD(ui->cur_x);
             ui->dy = SCOORD(ui->cur_y);
         }
-        return MOVE_UI_UPDATE;
+        return ret;
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
             ui->cur_visible = true;