mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Tracks: let solve make illegal moves
Not only does it set the outer edges to NOTRACK, but it may also overwrite any mistakes the user has previously made elsewhere. Otherwise, the entire solve is rejected ("Solve unavailable" error on Android) if the user has made a single mistake, which is inconsistent with the other games. This may be giving a free pass to corrupted moves that occur after a solve, so this may still want tightening up in some way, but it's still limited to squares within the grid, so I agree with Ben's assessment that this is likely not to be exploitable. Fixes #584 (cherry picked from Android port, commit 33bd14fb6f7cd760e7218fffd90f3a266b1f4123)
This commit is contained in:
4
tracks.c
4
tracks.c
@ -2429,7 +2429,7 @@ static game_state *execute_move(const game_state *state, const char *move)
|
|||||||
f = (c == 'T' || c == 't') ? S_TRACK : S_NOTRACK;
|
f = (c == 'T' || c == 't') ? S_TRACK : S_NOTRACK;
|
||||||
|
|
||||||
if (d == 'S') {
|
if (d == 'S') {
|
||||||
if (!ui_can_flip_square(ret, x, y, f == S_NOTRACK))
|
if (!ui_can_flip_square(ret, x, y, f == S_NOTRACK) && !ret->used_solve)
|
||||||
goto badmove;
|
goto badmove;
|
||||||
if (c == 'T' || c == 'N')
|
if (c == 'T' || c == 'N')
|
||||||
ret->sflags[y*w+x] |= f;
|
ret->sflags[y*w+x] |= f;
|
||||||
@ -2440,7 +2440,7 @@ static game_state *execute_move(const game_state *state, const char *move)
|
|||||||
unsigned df = 1<<i;
|
unsigned df = 1<<i;
|
||||||
|
|
||||||
if (MOVECHAR(df) == d) {
|
if (MOVECHAR(df) == d) {
|
||||||
if (!ui_can_flip_edge(ret, x, y, df, f == S_NOTRACK))
|
if (!ui_can_flip_edge(ret, x, y, df, f == S_NOTRACK) && !ret->used_solve)
|
||||||
goto badmove;
|
goto badmove;
|
||||||
if (c == 'T' || c == 'N')
|
if (c == 'T' || c == 'N')
|
||||||
S_E_SET(ret, x, y, df, f);
|
S_E_SET(ret, x, y, df, f);
|
||||||
|
Reference in New Issue
Block a user