aboutsummaryrefslogtreecommitdiff
path: root/src/libsok/sok.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsok/sok.h')
-rw-r--r--src/libsok/sok.h35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/libsok/sok.h b/src/libsok/sok.h
index 4fbae72..1503b5f 100644
--- a/src/libsok/sok.h
+++ b/src/libsok/sok.h
@@ -24,6 +24,15 @@ typedef enum {
SOK_DIR_LAST,
} sok_dir_t;
+#define SOK_DIR_TO_CHAR(dir) ( \
+ ((dir) == SOK_DIR_RIGHT) ? 'r' : \
+ (((dir) == SOK_DIR_UP) ? 'u' : \
+ ((((dir) == SOK_DIR_LEFT) ? 'l' : \
+ (((((dir) == SOK_DIR_DOWN) ? 'd' : \
+ 'X' \
+)))))))
+
+
#define SOK_DIR_TO_STR(dir) ( \
((dir) == SOK_DIR_RIGHT) ? "r" : \
(((dir) == SOK_DIR_UP) ? "u" : \
@@ -149,6 +158,11 @@ _Bool sok_ctx_undo(sok_ctx_t * const);
/* context walker */
/******************/
+typedef _Bool (*sok_ctx_walk_step_cb_t)(
+ const sok_ctx_t * const,
+ void * const
+);
+
typedef _Bool (*sok_ctx_walk_pos_cb_t)(
const sok_ctx_t * const,
const sok_pos_t,
@@ -177,11 +191,24 @@ typedef _Bool (*sok_ctx_walk_move_cb_t)(
);
typedef struct {
- sok_ctx_walk_pos_cb_t on_size,
- on_wall;
- sok_ctx_walk_tile_cb_t on_home,
- on_box;
+ sok_ctx_walk_pos_cb_t on_size;
+
+ sok_ctx_walk_step_cb_t on_walls_start,
+ on_walls_end;
+ sok_ctx_walk_pos_cb_t on_wall;
+
+ sok_ctx_walk_tile_cb_t on_home;
+
+ sok_ctx_walk_step_cb_t on_boxes_start,
+ on_boxes_end;
+ sok_ctx_walk_tile_cb_t on_box;
+
+ sok_ctx_walk_step_cb_t on_goals_start,
+ on_goals_end;
sok_ctx_walk_goal_cb_t on_goal;
+
+ sok_ctx_walk_step_cb_t on_moves_start,
+ on_moves_end;
sok_ctx_walk_move_cb_t on_move;
} sok_ctx_walk_cbs_t;