aboutsummaryrefslogtreecommitdiff
path: root/src/libsok
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2019-01-08 21:36:39 -0500
committerPaul Duncan <pabs@pablotron.org>2019-01-08 21:36:39 -0500
commit3f95b53036f456c2cff9ebc4fc6f26c36a1740eb (patch)
tree127feabc5b31df562934c205dadc3adeb193d796 /src/libsok
parentc4915c5cf04246b9e776ada61f6c917f363a78b7 (diff)
downloadsok-3f95b53036f456c2cff9ebc4fc6f26c36a1740eb.tar.bz2
sok-3f95b53036f456c2cff9ebc4fc6f26c36a1740eb.zip
add action.c, clean up key handling
Diffstat (limited to 'src/libsok')
-rw-r--r--src/libsok/sok-ctx.c2
-rw-r--r--src/libsok/sok.h10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libsok/sok-ctx.c b/src/libsok/sok-ctx.c
index 460c7ad..d514fe3 100644
--- a/src/libsok/sok-ctx.c
+++ b/src/libsok/sok-ctx.c
@@ -333,7 +333,7 @@ sok_ctx_move_box(
bool
sok_ctx_is_done(
- sok_ctx_t * const ctx
+ const sok_ctx_t * const ctx
) {
return ctx->num_goals_left == 0;
}
diff --git a/src/libsok/sok.h b/src/libsok/sok.h
index 3e64afd..a633d12 100644
--- a/src/libsok/sok.h
+++ b/src/libsok/sok.h
@@ -24,6 +24,14 @@ typedef enum {
SOK_DIR_LAST,
} sok_dir_t;
+#define SOK_DIR_TO_STR(dir) ( \
+ ((dir) == SOK_DIR_RIGHT) ? "r" : \
+ (((dir) == SOK_DIR_UP) ? "u" : \
+ ((((dir) == SOK_DIR_LEFT) ? "l" : \
+ (((((dir) == SOK_DIR_DOWN) ? "d" : \
+ "X" \
+)))))))
+
typedef struct {
sok_pos_t pos;
sok_dir_t dir;
@@ -128,7 +136,7 @@ void sok_ctx_init(sok_ctx_t * const ctx, void *user_data);
_Bool sok_ctx_set_level(sok_ctx_t * const ctx, const char * const level);
-_Bool sok_ctx_is_done(sok_ctx_t * const);
+_Bool sok_ctx_is_done(const sok_ctx_t * const);
_Bool sok_ctx_move(sok_ctx_t * const, const sok_dir_t);
_Bool sok_ctx_undo(sok_ctx_t * const);