aboutsummaryrefslogtreecommitdiff
path: root/cube.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-06-15 23:11:57 +0100
committerBen Harris <bjh21@bjh21.me.uk>2023-06-15 23:11:57 +0100
commit5fb94c9f4712bdfa82ef438a4f166540daf3d156 (patch)
treebf2bb8191a8163fd367d1490ed3f738928f30812 /cube.c
parent73e7bf73bbd68fbeac06ecdd77cc356c5365bb14 (diff)
downloadpuzzles-5fb94c9f4712bdfa82ef438a4f166540daf3d156.zip
puzzles-5fb94c9f4712bdfa82ef438a4f166540daf3d156.tar.gz
puzzles-5fb94c9f4712bdfa82ef438a4f166540daf3d156.tar.bz2
puzzles-5fb94c9f4712bdfa82ef438a4f166540daf3d156.tar.xz
Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Cube
Diffstat (limited to 'cube.c')
-rw-r--r--cube.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cube.c b/cube.c
index c4073b7..08788cb 100644
--- a/cube.c
+++ b/cube.c
@@ -1145,7 +1145,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
cy = (int)(state->grid->squares[state->current].y * GRID_SCALE) + ds->oy;
if (x == cx && y == cy)
- return NULL; /* clicked in exact centre! */
+ return MOVE_NO_EFFECT; /* clicked in exact centre! */
angle = atan2(y - cy, x - cx);
/*
@@ -1196,11 +1196,11 @@ static char *interpret_move(const game_state *state, game_ui *ui,
direction = RIGHT;
}
} else
- return NULL;
+ return MOVE_UNUSED;
mask = state->grid->squares[state->current].directions[direction];
if (mask == 0)
- return NULL;
+ return MOVE_NO_EFFECT;
/*
* Translate diagonal directions into orthogonal ones.
@@ -1215,14 +1215,14 @@ static char *interpret_move(const game_state *state, game_ui *ui,
}
if (find_move_dest(state, direction, skey, dkey) < 0)
- return NULL;
+ return MOVE_NO_EFFECT;
if (direction == LEFT) return dupstr("L");
if (direction == RIGHT) return dupstr("R");
if (direction == UP) return dupstr("U");
if (direction == DOWN) return dupstr("D");
- return NULL; /* should never happen */
+ return MOVE_NO_EFFECT; /* should never happen */
}
static game_state *execute_move(const game_state *from, const char *move)