From 32a0b44f0d46acc181db77d9043094c7ba1775bd Mon Sep 17 00:00:00 2001 From: jonny-vb Date: Sun, 7 Jan 2024 12:28:59 -0800 Subject: [PATCH] Fix LOGE macro (disable color on win), Fix map size "empty" - Recently added color to LOGE output did not compile on windows. Removed color support on windows for now. - Changed map size of map "empty" from 20x15 to 20x20 (square now) --- include/common.h | 16 +++++++--------- src/map.c | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/common.h b/include/common.h index f6b23e1..d15f2b0 100644 --- a/include/common.h +++ b/include/common.h @@ -25,20 +25,18 @@ #endif //conditional logging when ERROR_OUTPUT_ENABLED is defined in config.h -//also prints in text in red color +//also prints in text in red color (windows not supported) //example: LOGE("game: %d", count) #ifdef ERROR_OUTPUT_ENABLED -#ifdef _WIN32 - #include - #define RED_TEXT SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED) - #define RESET_TEXT SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) -#else + #ifdef _WIN32 //print error output in default color (currently no color support for windows) + #define LOGE(format, ...) printf("[E] " format, ##__VA_ARGS__) + #else //print error output in red color #define RED_TEXT "\033[1;31m" #define RESET_TEXT "\033[0m" -#endif -#define LOGE(format, ...) printf("[E] " RED_TEXT format RESET_TEXT, ##__VA_ARGS__) + #define LOGE(format, ...) printf(RED_TEXT "[E] " format RESET_TEXT, ##__VA_ARGS__) + #endif #else -#define LOGE(format, ...) do {} while (0) + #define LOGE(format, ...) do {} while (1) #endif diff --git a/src/map.c b/src/map.c index 07c0733..4eb5d8e 100644 --- a/src/map.c +++ b/src/map.c @@ -224,7 +224,7 @@ static const map_t map_default = { static const map_t map_empty = { .width = 20, - .height = 15, + .height = 20, .name = "empty", .collisions = {}, .collisionCount = 0,