chiark / gitweb /
Tracks: tighten up a small loophole in completion checking.
authorSimon Tatham <anakin@pobox.com>
Wed, 24 Feb 2016 19:18:30 +0000 (19:18 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 24 Feb 2016 19:18:30 +0000 (19:18 +0000)
If you had a single connected path linking the source to the
destination but _also_ had a spurious edge elsewhere in the grid, then
the spurious edge would be highlighted as an error, but it wouldn't
inhibit declaring the game complete and showing the victory flash.

tracks.c

index d633a9ca1caef0399983ec706a7942abe9be25d6..2fefe36ddd4f575a384e42919e803a2f5606b89c 100644 (file)
--- a/tracks.c
+++ b/tracks.c
@@ -1646,8 +1646,10 @@ static int check_completion(game_state *state, int mark)
             for (i = 0; i < w*h; i++) {
                 if ((dsf_canonify(dsf, i) != pathclass) &&
                     ((state->sflags[i] & S_TRACK) ||
-                     (S_E_COUNT(state, i%w, i/w, E_TRACK) > 0)))
+                     (S_E_COUNT(state, i%w, i/w, E_TRACK) > 0))) {
+                    ret = FALSE;
                     state->sflags[i] |= S_ERROR;
+                }
             }
         }
     }