chiark / gitweb /
Slant: hide keyboard cursor when using the mouse.
[sgt-puzzles.git] / signpost.c
index 5650b2b67309a7c6f31afdba9de6e912eb7e8c16..f0784ebd40b128d763afba9b22be2f06e6d19564 100644 (file)
@@ -1578,6 +1578,8 @@ static game_state *execute_move(const game_state *state, const char *move)
         si = sy*w+sx; ei = ey*w+ex;
         makelink(ret, si, ei);
     } else if (sscanf(move, "%c%d,%d", &c, &sx, &sy) == 3) {
+        int sset;
+
         if (c != 'C' && c != 'X') return NULL;
         if (!INGRID(state, sx, sy)) return NULL;
         si = sy*w+sx;
@@ -1586,11 +1588,12 @@ static game_state *execute_move(const game_state *state, const char *move)
 
         ret = dup_game(state);
 
-        if (c == 'C') {
+        sset = state->nums[si] / (state->n+1);
+        if (c == 'C' || (c == 'X' && sset == 0)) {
             /* Unlink the single cell we dragged from the board. */
             unlink_cell(ret, si);
         } else {
-            int i, set, sset = state->nums[si] / (state->n+1);
+            int i, set;
             for (i = 0; i < state->n; i++) {
                 /* Unlink all cells in the same set as the one we dragged
                  * from the board. */
@@ -1982,7 +1985,7 @@ static void draw_drag_indicator(drawing *dr, game_drawstate *ds,
         /* Draw an arrow pointing away from/towards the origin cell. */
         int ox = COORD(ui->sx) + TILE_SIZE/2, oy = COORD(ui->sy) + TILE_SIZE/2;
         double tana, offset;
-        double xdiff = fabs(ox - ui->dx), ydiff = fabs(oy - ui->dy);
+        double xdiff = abs(ox - ui->dx), ydiff = abs(oy - ui->dy);
 
         if (xdiff == 0) {
             ang = (oy > ui->dy) ? 0.0F : PI;