shithub: cstory

Download patch

ref: 7bf3109019618aeca207d306ba1e57360c2a1314
parent: d2df9d91045b008aae8f3387983c53bccbade666
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Sep 25 13:29:22 EDT 2019

Cast X_TO_UNITS and UNITS_TO_X values to int

This shuts up some MSVC warnings about implicitly casting doubles to
ints when the macros' results are assigned to variables.

--- a/src/CommonDefines.h
+++ b/src/CommonDefines.h
@@ -3,15 +3,15 @@
 #define WINDOW_WIDTH 320
 #define WINDOW_HEIGHT 240
 
-#define TILES_TO_PIXELS(x) ((x) * 0x10)
-#define PIXELS_TO_TILES(x) ((x) / 0x10)
-#define PIXELS_TO_UNITS(x) ((x) * 0x200)
-#define UNITS_TO_PIXELS(x) ((x) / 0x200)
-#define TILES_TO_UNITS(x) ((x) * (0x200 * 0x10))
-#define UNITS_TO_TILES(x) ((x) / (0x200 * 0x10))
+#define TILES_TO_PIXELS(x) ((int)((x) * 0x10))
+#define PIXELS_TO_TILES(x) ((int)((x) / 0x10))
+#define PIXELS_TO_UNITS(x) ((int)((x) * 0x200))
+#define UNITS_TO_PIXELS(x) ((int)((x) / 0x200))
+#define TILES_TO_UNITS(x) ((int)((x) * (0x200 * 0x10)))
+#define UNITS_TO_TILES(x) ((int)((x) / (0x200 * 0x10)))
 
-#define SECONDS_TO_FRAMES(x) ((x) * 50)
-#define FRAMES_TO_SECONDS(x) ((x) / 50)
+#define SECONDS_TO_FRAMES(x) ((int)((x) * 50))
+#define FRAMES_TO_SECONDS(x) ((int)((x) / 50))
 
 enum Collisions
 {