macros.h
changeset 3941 34116fc17887
parent 3812 d9b3041ee3d0
child 3943 c48d912ad44c
--- a/macros.h	Sat Jun 03 15:10:39 2006 +0000
+++ b/macros.h	Sat Jun 03 15:14:41 2006 +0000
@@ -73,7 +73,7 @@
 #define SETBITS(x,y) ((x) |= (y))
 #define CLRBITS(x,y) ((x) &= ~(y))
 
-#define GENERAL_SPRITE_COLOR(color) ( (color + PALETTE_RECOLOR_START) << PALETTE_SPRITE_START)
+#define GENERAL_SPRITE_COLOR(color) ( ((color) + PALETTE_RECOLOR_START) << PALETTE_SPRITE_START)
 #define PLAYER_SPRITE_COLOR(owner) ( GENERAL_SPRITE_COLOR(_player_colors[owner]))
 #define SPRITE_PALETTE(x) ((x) | PALETTE_MODIFIER_COLOR)
 
@@ -125,9 +125,9 @@
 #define IS_INT_INSIDE(a,min,max) ((uint)((a)-(min)) < (uint)((max)-(min)))
 
 
-#define CHANCE16(a,b) ((uint16)Random() <= (uint16)((65536 * a) / b))
-#define CHANCE16R(a,b,r) ((uint16)(r=Random()) <= (uint16)((65536 * a) / b))
-#define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * a) / b))
+#define CHANCE16(a,b) ((uint16)Random() <= (uint16)((65536 * (a)) / (b)))
+#define CHANCE16R(a,b,r) ((uint16)(r=Random()) <= (uint16)((65536 * a) / (b)))
+#define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * (a)) / (b)))
 
 
 #define for_each_bit(_i, _b)            \