aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-01-08 10:05:12 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-01-15 16:21:37 +0000
commit4845f3e913a02417fe7a8d84c6407d40807ec0ec (patch)
tree12287d2681e64958fefdba94ef1ccbe3f483d8b6
parent952ef8ca565d803da1134466358bd85683a489a3 (diff)
downloadpuzzles-4845f3e913a02417fe7a8d84c6407d40807ec0ec.zip
puzzles-4845f3e913a02417fe7a8d84c6407d40807ec0ec.tar.gz
puzzles-4845f3e913a02417fe7a8d84c6407d40807ec0ec.tar.bz2
puzzles-4845f3e913a02417fe7a8d84c6407d40807ec0ec.tar.xz
Correct RANGECHECK macro in Black Box
Lasers are numbered from 0 to nlasers-1 inclusive, so the upper limit should be "<", not "<=".
-rw-r--r--blackbox.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/blackbox.c b/blackbox.c
index f8d6b27..7918c53 100644
--- a/blackbox.c
+++ b/blackbox.c
@@ -305,7 +305,7 @@ struct game_state {
#define GRID(s,x,y) ((s)->grid[(y)*((s)->w+2) + (x)])
-#define RANGECHECK(s,x) ((x) >= 0 && (x) <= (s)->nlasers)
+#define RANGECHECK(s,x) ((x) >= 0 && (x) < (s)->nlasers)
/* specify numbers because they must match array indexes. */
enum { DIR_UP = 0, DIR_RIGHT = 1, DIR_DOWN = 2, DIR_LEFT = 3 };