aboutsummaryrefslogtreecommitdiff
path: root/src/libsok
diff options
context:
space:
mode:
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);