diff options
author | Paul Duncan <pabs@pablotron.org> | 2019-01-09 05:49:31 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2019-01-09 05:49:31 -0500 |
commit | d010dba0efaba8f5be2191bd52c8a40705a9ec28 (patch) | |
tree | 3359a296e1786aaf827461a785fb1938138f9eb7 /src/text | |
parent | 1aa27ed5589c1b310037b0e6d09765888f2da29a (diff) | |
download | sok-d010dba0efaba8f5be2191bd52c8a40705a9ec28.tar.bz2 sok-d010dba0efaba8f5be2191bd52c8a40705a9ec28.zip |
add reset
Diffstat (limited to 'src/text')
-rw-r--r-- | src/text/action.c | 2 | ||||
-rw-r--r-- | src/text/action.h | 1 | ||||
-rw-r--r-- | src/text/main.c | 7 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/text/action.c b/src/text/action.c index 3d63bce..3381c0a 100644 --- a/src/text/action.c +++ b/src/text/action.c @@ -56,6 +56,8 @@ get_action(void) { .type = ACTION_WARP, .data = atoi(buf), }; + case 'r': + return (action_t) { .type = ACTION_RESET }; case 's': return (action_t) { .type = ACTION_SOLVE }; default: diff --git a/src/text/action.h b/src/text/action.h index d77b3ef..77f0e9c 100644 --- a/src/text/action.h +++ b/src/text/action.h @@ -11,6 +11,7 @@ typedef enum { ACTION_UNDO, ACTION_NEXT, ACTION_SOLVE, + ACTION_RESET, ACTION_LAST, } action_type_t; diff --git a/src/text/main.c b/src/text/main.c index db4a48c..7d6f144 100644 --- a/src/text/main.c +++ b/src/text/main.c @@ -82,6 +82,13 @@ int main(int argc, char *argv[]) { } break; + case ACTION_RESET: + // reset level + if (!sok_ctx_set_level(&ctx, level->data)) { + die("Couldn't load level %zu", level_num); + } + + break; case ACTION_WARP: level_num = action.data; level = levels_get_level(level_num); |