chiark / gitweb /
Don't create an undo-chain entry for a move with no effect.
authorSimon Tatham <anakin@pobox.com>
Sun, 25 Feb 2007 13:00:58 +0000 (13:00 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 25 Feb 2007 13:00:58 +0000 (13:00 +0000)
[originally from svn r7333]

filling.c

index ac5b6d91b175feb9e3c6d7a5981a0b0fb74fbbc4..82efcca75f04a9463883704a58d4a1a22b8e3e9e 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);
+       }
     }
 }