shithub: puzzles

Download patch

ref: 503f1c4ab81928c2792a2cf73bc97587460dac86
parent: e30d11ecd169c2e963fada4cac28123b4f4f9a7e
author: Ben Harris <bjh21@bjh21.me.uk>
date: Wed Aug 9 11:58:34 EDT 2023

Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Light Up

Light Up is unusual in that clicking outside the grid hides the
cursor, so the return value from clicks outside the grid is
MOVE_NO_EFFECT or MOVE_UI_UPDATE rather than the more usual
MOVE_UNUSED.

--- a/lightup.c
+++ b/lightup.c
@@ -1954,7 +1954,7 @@
     enum { NONE, FLIP_LIGHT, FLIP_IMPOSSIBLE } action = NONE;
     int cx = -1, cy = -1;
     unsigned int flags;
-    char buf[80], *nullret = MOVE_UI_UPDATE, *empty = MOVE_UI_UPDATE, c;
+    char buf[80], *nullret = MOVE_NO_EFFECT, *empty = MOVE_UI_UPDATE, c;
 
     if (button == LEFT_BUTTON || button == RIGHT_BUTTON) {
         if (ui->cur_visible)
@@ -1978,7 +1978,7 @@
         nullret = move_cursor(button, &ui->cur_x, &ui->cur_y,
                               state->w, state->h, false, &ui->cur_visible);
     } else
-        return NULL;
+        return MOVE_UNUSED;
 
     switch (action) {
     case FLIP_LIGHT: