shithub: puzzles

Download patch

ref: 19b3bfc0d387424d6318027a1c3ff4b3ac532f19
parent: 1547154efbfcf0bd8f6fc4f91fe99c26371fe0ee
author: Ben Harris <bjh21@bjh21.me.uk>
date: Sat Jun 10 19:02:07 EDT 2023

Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Slant

--- a/slant.c
+++ b/slant.c
@@ -1727,7 +1727,7 @@
         x = FROMCOORD(x);
         y = FROMCOORD(y);
         if (x < 0 || y < 0 || x >= w || y >= h)
-            return NULL;
+            return MOVE_UNUSED;
         ui->cur_visible = false;
     } else if (IS_CURSOR_SELECT(button)) {
         if (!ui->cur_visible) {
@@ -1744,7 +1744,8 @@
         return MOVE_UI_UPDATE;
     } else if (button == '\\' || button == '\b' || button == '/') {
 	int x = ui->cur_x, y = ui->cur_y;
-	if (button == ("\\" "\b" "/")[state->soln[y*w + x] + 1]) return NULL;
+	if (button == ("\\" "\b" "/")[state->soln[y*w + x] + 1])
+            return MOVE_NO_EFFECT;
 	sprintf(buf, "%c%d,%d", button == '\b' ? 'C' : button, x, y);
 	return dupstr(buf);
     }
@@ -1770,7 +1771,7 @@
         return dupstr(buf);
     }
 
-    return NULL;
+    return MOVE_UNUSED;
 }
 
 static game_state *execute_move(const game_state *state, const char *move)