chiark / gitweb /
Add a missing error message in Flood solve_game().
authorSimon Tatham <anakin@pobox.com>
Thu, 24 Dec 2015 22:05:48 +0000 (22:05 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 24 Dec 2015 22:05:48 +0000 (22:05 +0000)
The only situation in which it actually can't find a solution is if
the puzzle is already solved, in which case it can at least fill in
*error to say so before it returns NULL.

flood.c

diff --git a/flood.c b/flood.c
index bbba91528bdee8f82e9993f122fa80deb7a72bf7..f97de2fa7cf5b7885eb59ec2a128c0e561da7153 100644 (file)
--- a/flood.c
+++ b/flood.c
@@ -697,8 +697,10 @@ static char *solve_game(const game_state *state, const game_state *currstate,
     char buf[256];
     struct solver_scratch *scratch;
 
-    if (currstate->complete)
+    if (currstate->complete) {
+        *error = "Puzzle is already solved";
         return NULL;
+    }
 
     /*
      * Find the best solution our solver can give.