diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-01-08 10:05:12 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-01-15 16:21:37 +0000 |
| commit | 4845f3e913a02417fe7a8d84c6407d40807ec0ec (patch) | |
| tree | 12287d2681e64958fefdba94ef1ccbe3f483d8b6 | |
| parent | 952ef8ca565d803da1134466358bd85683a489a3 (diff) | |
| download | puzzles-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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 }; |