Don't create an undo-chain entry for a move with no effect.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 25 Feb 2007 13:00:58 +0000 (13:00 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 25 Feb 2007 13:00:58 +0000 (13:00 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@7333 cda61777-01e9-0310-a592-d414129be87e

filling.c

index ac5b6d9..82efcca 100644 (file)
--- a/filling.c
+++ b/filling.c
@@ -962,9 +962,13 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
     {
         const int i = w*ui->y + ui->x;
         char buf[64];
-        sprintf(buf, "%d_%d", i, button);
         ui->x = ui->y = -1;
-        return dupstr(buf);
+       if (state->board[i] == button) {
+           return "";                 /* no change - just update ui */
+       } else {
+           sprintf(buf, "%d_%d", i, button);
+           return dupstr(buf);
+       }
     }
 }