From 4c1e47b272274972556d7790384998e593d0ae57 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 17 Aug 2019 17:36:51 +0100 Subject: [PATCH] Bridges: Fix off-by-one in WITHIN() WITHIN() used to treat the min and max as inclusive bounds but was changed to treat the max as exclusive, apparently accidentally. Fixed: 5f5b284c0bdd ("Use C99 bool within source modules.") --- bridges.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges.c b/bridges.c index 03b0623..074940c 100644 --- a/bridges.c +++ b/bridges.c @@ -183,7 +183,7 @@ struct game_state { #define GRIDCOUNT(s,x,y,f) ((GRID(s,x,y) & (f)) ? (INDEX(s,lines,x,y)) : 0) -#define WITHIN2(x,min,max) ((x) >= (min) && (x) < (max)) +#define WITHIN2(x,min,max) ((x) >= (min) && (x) <= (max)) #define WITHIN(x,min,max) ((min) > (max) ? \ WITHIN2(x,max,min) : WITHIN2(x,min,max))