chiark / gitweb /
Fix completion checking in Killer Solo.
[sgt-puzzles.git] / towers.c
index b5092f013ce403a0a97655f391fe98983e1d3769..9525adb56b19aec96fb011c78ffd80c24cd6f5ee 100644 (file)
--- a/towers.c
+++ b/towers.c
@@ -1248,7 +1248,8 @@ static int check_errors(const game_state *state, int *errors)
            }
        }
 
-       if (n > clues[i] || (j == w && n < clues[i])) {
+       if (n > clues[i] || (best == w && n < clues[i]) ||
+           (best < w && n == clues[i])) {
            if (errors) {
                int x, y;
                CLUEPOS(x, y, i, w);
@@ -1292,6 +1293,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
                             int x, int y, int button)
 {
     int w = state->par.w;
+    int shift_or_control = button & (MOD_SHFT | MOD_CTRL);
     int tx, ty;
     char buf[80];
 
@@ -1376,6 +1378,20 @@ static char *interpret_move(const game_state *state, game_ui *ui,
         }
     }
     if (IS_CURSOR_MOVE(button)) {
+        if (shift_or_control) {
+            int x = ui->hx, y = ui->hy;
+            switch (button) {
+            case CURSOR_LEFT:   x = -1; break;
+            case CURSOR_RIGHT:  x =  w; break;
+            case CURSOR_UP:     y = -1; break;
+            case CURSOR_DOWN:   y =  w; break;
+            }
+            if (is_clue(state, x, y)) {
+                sprintf(buf, "%c%d,%d", 'D', x, y);
+                return dupstr(buf);
+            }
+            return NULL;
+        }
         move_cursor(button, &ui->hx, &ui->hy, w, w, 0);
         ui->hshow = ui->hcursor = 1;
         return "";