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.")
This commit is contained in:
Ben Hutchings
2019-08-17 17:36:51 +01:00
committed by Simon Tatham
parent cd338a1a35
commit 4c1e47b272

View File

@ -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 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) ? \ #define WITHIN(x,min,max) ((min) > (max) ? \
WITHIN2(x,max,min) : WITHIN2(x,min,max)) WITHIN2(x,max,min) : WITHIN2(x,min,max))