diff --git a/CMakeLists.txt b/CMakeLists.txt index ec3f041..4c62912 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,7 +264,7 @@ if (NOT DEBUG_BUILD) "pitlayouts.dat" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data ) - if (WIN32) + if (WIN32 AND NOT MSVC) add_definitions(-mwindows) endif() else() diff --git a/src/defines.h b/src/defines.h index aabe8a2..bf47b98 100644 --- a/src/defines.h +++ b/src/defines.h @@ -68,8 +68,12 @@ #define C_YELLOW (SDL_Color) { 255, 255, 0, 255 } #define C_BLACK (SDL_Color) { 0, 0, 0, 255 } +// MSVC seems to have min/max defined. +// Haven't looked into it further. +#ifndef _MSC_VER #define max(a, b) (a > b ? a : b) #define min(a, b) (a < b ? a : b) +#endif // _MSC_VER typedef enum Direction_t { UP, DOWN, LEFT, RIGHT diff --git a/src/particle_engine.c b/src/particle_engine.c index 316588d..f2f18b7 100644 --- a/src/particle_engine.c +++ b/src/particle_engine.c @@ -255,7 +255,7 @@ particle_engine_sparkle(Position pos, Dimension dim) alpha = get_random(155) + 100; - yv = -(get_random(100) + 100); + yv = 0 - (get_random(100) + 100); lt = get_random(20); diff --git a/test/test_hashtable.c b/test/test_hashtable.c index aaae78c..fa2da92 100644 --- a/test/test_hashtable.c +++ b/test/test_hashtable.c @@ -24,6 +24,7 @@ #include #include #include "../src/hashtable.h" +#include "../src/util.h" static void test_hashtable_create(void **state) { @@ -113,7 +114,7 @@ static void test_hashtable_foreach(void **state) int *num = malloc(sizeof(int)); assert_non_null( num ); *num = i; - sprintf(str, "%d", *num); + m_sprintf(str, 4, "%d", *num); ht_set(table, str, num); }