aboutsummaryrefslogtreecommitdiff
path: root/src/libsok/sok-ctx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsok/sok-ctx.c')
-rw-r--r--src/libsok/sok-ctx.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/libsok/sok-ctx.c b/src/libsok/sok-ctx.c
index 26c6239..ec36d2a 100644
--- a/src/libsok/sok-ctx.c
+++ b/src/libsok/sok-ctx.c
@@ -201,59 +201,59 @@ sok_ctx_count_goals_left(
return r;
}
-/*
+/*
* static bool
* sok_ctx_has_corner_boxes(
* const sok_ctx_t * const ctx
* ) {
* for (size_t i = 0; i < ctx->level.num_boxes; i++) {
* // right
- * const bool r = ctx_is_wall(ctx, (sok_pos_t) {
+ * const bool r = ctx_is_wall(ctx, (sok_pos_t) {
* .x = ctx->boxes[i].x + 1,
- * .y = ctx->boxes[i].y,
+ * .y = ctx->boxes[i].y,
* });
- *
+ *
* // top-right
- * const bool tr = ctx_is_wall(ctx, (sok_pos_t) {
+ * const bool tr = ctx_is_wall(ctx, (sok_pos_t) {
* .x = ctx->boxes[i].x + 1,
- * .y = ctx->boxes[i].y - 1,
+ * .y = ctx->boxes[i].y - 1,
* });
- *
+ *
* // top
- * const bool t = ctx_is_wall(ctx, (sok_pos_t) {
+ * const bool t = ctx_is_wall(ctx, (sok_pos_t) {
* .x = ctx->boxes[i].x,
- * .y = ctx->boxes[i].y - 1,
+ * .y = ctx->boxes[i].y - 1,
* });
- *
+ *
* // top-left
- * const bool tl = ctx_is_wall(ctx, (sok_pos_t) {
+ * const bool tl = ctx_is_wall(ctx, (sok_pos_t) {
* .x = ctx->boxes[i].x - 1,
- * .y = ctx->boxes[i].y - 1,
+ * .y = ctx->boxes[i].y - 1,
* });
- *
+ *
* // left
- * const bool l = ctx_is_wall(ctx, (sok_pos_t) {
+ * const bool l = ctx_is_wall(ctx, (sok_pos_t) {
* .x = ctx->boxes[i].x - 1,
- * .y = ctx->boxes[i].y,
+ * .y = ctx->boxes[i].y,
* });
- *
+ *
* // bottom-left
- * const bool bl = ctx_is_wall(ctx, (sok_pos_t) {
+ * const bool bl = ctx_is_wall(ctx, (sok_pos_t) {
* .x = ctx->boxes[i].x - 1,
- * .y = ctx->boxes[i].y + 1,
+ * .y = ctx->boxes[i].y + 1,
* });
- *
+ *
* // bottom
- * const bool b = ctx_is_wall(ctx, (sok_pos_t) {
+ * const bool b = ctx_is_wall(ctx, (sok_pos_t) {
* .x = ctx->boxes[i].x,
- * .y = ctx->boxes[i].y + 1,
+ * .y = ctx->boxes[i].y + 1,
* });
- *
- * const bool br = ctx_is_wall(ctx, (sok_pos_t) {
+ *
+ * const bool br = ctx_is_wall(ctx, (sok_pos_t) {
* .x = ctx->boxes[i].x + 1,
- * .y = ctx->boxes[i].y + 1,
+ * .y = ctx->boxes[i].y + 1,
* });
- *
+ *
* if (
* (r && tr && t) || // top-right
* (t && tl && l) || // top-left
@@ -264,10 +264,10 @@ sok_ctx_count_goals_left(
* return true;
* }
* }
- *
+ *
* return false;
* }
- */
+ */
void
sok_ctx_init(sok_ctx_t * const ctx, void *user_data) {
@@ -407,14 +407,14 @@ sok_ctx_is_done(
return ctx->num_goals_left == 0;
}
-/*
+/*
* bool
* sok_ctx_is_lost(
* const sok_ctx_t * const ctx
* ) {
* return ctx->is_lost;
* }
- */
+ */
bool
sok_ctx_move(
@@ -435,18 +435,18 @@ sok_ctx_move(
}};
const bool can_move = (
- (dir == SOK_DIR_UP) ? (ctx->home.y > 0) :
+ (dir == SOK_DIR_UP) ? (ctx->home.y > 0) :
((dir == SOK_DIR_DOWN) ? (ctx->home.y < SOK_LEVEL_MAX_HEIGHT - 1) :
- ((dir == SOK_DIR_LEFT) ? (ctx->home.x > 0) :
- ((dir == SOK_DIR_RIGHT) ? (ctx->home.x < SOK_LEVEL_MAX_WIDTH - 1) :
+ ((dir == SOK_DIR_LEFT) ? (ctx->home.x > 0) :
+ ((dir == SOK_DIR_RIGHT) ? (ctx->home.x < SOK_LEVEL_MAX_WIDTH - 1) :
false
))));
const bool can_push = (
- (dir == SOK_DIR_UP) ? (ctx->home.y > 1) :
+ (dir == SOK_DIR_UP) ? (ctx->home.y > 1) :
((dir == SOK_DIR_DOWN) ? (ctx->home.y < SOK_LEVEL_MAX_HEIGHT - 2) :
- ((dir == SOK_DIR_LEFT) ? (ctx->home.x > 1) :
- ((dir == SOK_DIR_RIGHT) ? (ctx->home.x < SOK_LEVEL_MAX_WIDTH - 2) :
+ ((dir == SOK_DIR_LEFT) ? (ctx->home.x > 1) :
+ ((dir == SOK_DIR_RIGHT) ? (ctx->home.x < SOK_LEVEL_MAX_WIDTH - 2) :
false
))));
@@ -454,7 +454,7 @@ sok_ctx_move(
can_move &&
tile_is_floor(ctx, ps[0]) &&
!tile_is_box(ctx, ps[0])
- ) {
+ ) {
// push move
if (!sok_ctx_push_move(ctx, dir, false)) {
return false;
@@ -472,7 +472,7 @@ sok_ctx_move(
tile_is_box(ctx, ps[0]) &&
tile_is_floor(ctx, ps[1]) &&
!tile_is_box(ctx, ps[1])
- ) {
+ ) {
// push move
if (!sok_ctx_push_move(ctx, dir, true)) {
return false;