(XYOFFSET): Parenthesize macro parameters in expansion.

This commit is contained in:
Markus Armbruster 2006-04-17 12:51:23 +00:00
parent 8b1c21a7bd
commit e264be1a78

View file

@ -39,10 +39,12 @@
/* Used to calculate an offset into an array. Used for /* Used to calculate an offset into an array. Used for
dynamically sizing the world. */ dynamically sizing the world. */
#define XYOFFSET(x, y) ((y * WORLD_X) + x) #define XYOFFSET(x, y) (((y) * WORLD_X) + (x))
#define XNORM(x) (((x)<0) ? ((WORLD_X-(-(x)%WORLD_X))%WORLD_X) : ((x)%WORLD_X)) #define XNORM(x) \
#define YNORM(y) (((y)<0) ? ((WORLD_Y-(-(y)%WORLD_Y))%WORLD_Y) : ((y)%WORLD_Y)) (((x) < 0) ? ((WORLD_X - (-(x) % WORLD_X)) % WORLD_X) : ((x) % WORLD_X))
#define YNORM(y) \
(((y) < 0) ? ((WORLD_Y - (-(y) % WORLD_Y)) % WORLD_Y) : ((y) % WORLD_Y))
struct range { struct range {
coord lx; /* low-range x,y */ coord lx; /* low-range x,y */