ref: 5fb94c9f4712bdfa82ef438a4f166540daf3d156
parent: 73e7bf73bbd68fbeac06ecdd77cc356c5365bb14
author: Ben Harris <bjh21@bjh21.me.uk>
date: Thu Jun 15 19:11:57 EDT 2023
Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Cube
--- a/cube.c
+++ b/cube.c
@@ -1145,7 +1145,7 @@
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 @@
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,7 +1215,7 @@
}
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");
@@ -1222,7 +1222,7 @@
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)