diff options
author | Franklin Wei <git@fwei.tk> | 2017-08-23 14:20:07 -0400 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-08-23 14:22:09 -0400 |
commit | 3c514f8e20ea8762025a12f9edbea27967e31d76 (patch) | |
tree | ed44527b00a128ce85f507e1abda8dbbbf7de4cb /apps/plugins/puzzles/src/loopy.c | |
parent | 4dd300d9f0229269aa8f9a46b07a5aa65f882985 (diff) | |
download | rockbox-3c514f8e20ea8762025a12f9edbea27967e31d76.tar.gz rockbox-3c514f8e20ea8762025a12f9edbea27967e31d76.zip |
puzzles: misc. changes and sync with upstream
This brings puzzles up-to-date with Simon's tree, along with the
rockbox-specific changes I made. Note that I also got rid of some
of the ugly floating-point code in rbwrappers.c and replaced it
with wrappers for our fixed-point library.
Change-Id: Ibfb79acb15517116a26de1c3ea89e025146b9e2e
Diffstat (limited to 'apps/plugins/puzzles/src/loopy.c')
-rw-r--r-- | apps/plugins/puzzles/src/loopy.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/loopy.c b/apps/plugins/puzzles/src/loopy.c index 652b9ecc09..7d3436aacb 100644 --- a/apps/plugins/puzzles/src/loopy.c +++ b/apps/plugins/puzzles/src/loopy.c | |||
@@ -3054,6 +3054,24 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
3054 | state->lines[e_next - g->edges] != state->lines[i]) | 3054 | state->lines[e_next - g->edges] != state->lines[i]) |
3055 | break; | 3055 | break; |
3056 | 3056 | ||
3057 | if (e_next == e) { | ||
3058 | /* | ||
3059 | * Special case: we might have come all the | ||
3060 | * way round a loop and found our way back to | ||
3061 | * the same edge we started from. In that | ||
3062 | * situation, we must terminate not only this | ||
3063 | * while loop, but the 'for' outside it that | ||
3064 | * was tracing in both directions from the | ||
3065 | * starting edge, because if we let it trace | ||
3066 | * in the second direction then we'll only | ||
3067 | * find ourself traversing the same loop in | ||
3068 | * the other order and generate an encoded | ||
3069 | * move string that mentions the same set of | ||
3070 | * edges twice. | ||
3071 | */ | ||
3072 | goto autofollow_done; | ||
3073 | } | ||
3074 | |||
3057 | dot = (e_next->dot1 != dot ? e_next->dot1 : e_next->dot2); | 3075 | dot = (e_next->dot1 != dot ? e_next->dot1 : e_next->dot2); |
3058 | if (movelen > movesize - 40) { | 3076 | if (movelen > movesize - 40) { |
3059 | movesize = movesize * 5 / 4 + 128; | 3077 | movesize = movesize * 5 / 4 + 128; |
@@ -3064,6 +3082,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, | |||
3064 | (int)(e_this - g->edges), button_char); | 3082 | (int)(e_this - g->edges), button_char); |
3065 | } | 3083 | } |
3066 | } | 3084 | } |
3085 | autofollow_done:; | ||
3067 | } | 3086 | } |
3068 | } | 3087 | } |
3069 | 3088 | ||