shithub: puzzles

Download patch

ref: a7408203eb9a3720cd9a7828253de844faf3ce44
parent: b9fd636928ac476b232d6854e32305392764217c
author: Simon Tatham <[email protected]>
date: Sun Feb 25 08:00:58 EST 2007

Don't create an undo-chain entry for a move with no effect.

[originally from svn r7333]

--- a/filling.c
+++ b/filling.c
@@ -962,9 +962,13 @@
     {
         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);
+	}
     }
 }