diff options
author | Franklin Wei <git@fwei.tk> | 2017-10-29 17:39:29 -0400 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-10-29 17:39:29 -0400 |
commit | 1f3e70aafcdeaf13eeb906fba97825b5d64ccde9 (patch) | |
tree | 47ad3f6677d46e4963a833280b7af85c3b0309e9 /apps/plugins/puzzles/src/solo.c | |
parent | 2423d3d4ae1e7093b65e0c56e50ec705e34327b6 (diff) | |
download | rockbox-1f3e70aafcdeaf13eeb906fba97825b5d64ccde9.tar.gz rockbox-1f3e70aafcdeaf13eeb906fba97825b5d64ccde9.zip |
puzzles: sync with upstream
This includes the fix for Map's incorrect cursor positioning when
zoomed in.
Change-Id: I7d7d1f3031bbe1390e89340039996f99efaa8ef5
Diffstat (limited to 'apps/plugins/puzzles/src/solo.c')
-rw-r--r-- | apps/plugins/puzzles/src/solo.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/apps/plugins/puzzles/src/solo.c b/apps/plugins/puzzles/src/solo.c index ef2852f1d9..dd04cdf281 100644 --- a/apps/plugins/puzzles/src/solo.c +++ b/apps/plugins/puzzles/src/solo.c | |||
@@ -1013,12 +1013,23 @@ static int solver_set(struct solver_usage *usage, | |||
1013 | 1013 | ||
1014 | /* | 1014 | /* |
1015 | * If count == 0, then there's a row with no 1s at all and | 1015 | * If count == 0, then there's a row with no 1s at all and |
1016 | * the puzzle is internally inconsistent. However, we ought | 1016 | * the puzzle is internally inconsistent. |
1017 | * to have caught this already during the simpler reasoning | ||
1018 | * methods, so we can safely fail an assertion if we reach | ||
1019 | * this point here. | ||
1020 | */ | 1017 | */ |
1021 | assert(count > 0); | 1018 | if (count == 0) { |
1019 | #ifdef STANDALONE_SOLVER | ||
1020 | if (solver_show_working) { | ||
1021 | va_list ap; | ||
1022 | printf("%*s", solver_recurse_depth*4, | ||
1023 | ""); | ||
1024 | va_start(ap, fmt); | ||
1025 | vprintf(fmt, ap); | ||
1026 | va_end(ap); | ||
1027 | printf(":\n%*s solver_set: impossible on entry\n", | ||
1028 | solver_recurse_depth*4, ""); | ||
1029 | } | ||
1030 | #endif | ||
1031 | return -1; | ||
1032 | } | ||
1022 | if (count == 1) | 1033 | if (count == 1) |
1023 | rowidx[i] = colidx[first] = FALSE; | 1034 | rowidx[i] = colidx[first] = FALSE; |
1024 | } | 1035 | } |
@@ -1465,7 +1476,14 @@ static int solver_killer_sums(struct solver_usage *usage, int b, | |||
1465 | assert(nsquares == 0); | 1476 | assert(nsquares == 0); |
1466 | return 0; | 1477 | return 0; |
1467 | } | 1478 | } |
1468 | assert(nsquares > 0); | 1479 | if (nsquares == 0) { |
1480 | #ifdef STANDALONE_SOLVER | ||
1481 | if (solver_show_working) | ||
1482 | printf("%*skiller: cage has no usable squares left\n", | ||
1483 | solver_recurse_depth*4, ""); | ||
1484 | #endif | ||
1485 | return -1; | ||
1486 | } | ||
1469 | 1487 | ||
1470 | if (nsquares < 2 || nsquares > 4) | 1488 | if (nsquares < 2 || nsquares > 4) |
1471 | return 0; | 1489 | return 0; |