From fcf1f24547cb57642969f2c10ea9c9c928131955 Mon Sep 17 00:00:00 2001 From: Linus Probert Date: Fri, 4 May 2018 01:22:40 +1000 Subject: [PATCH] Fixed log prints in release mode and some better fail handling. --- src/main.c | 11 +++++++---- src/util.c | 11 +++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index c69f129..0fa0fd4 100644 --- a/src/main.c +++ b/src/main.c @@ -339,9 +339,12 @@ resetGame(void) static bool init(void) { - bool result = true; - result = result && initSDL(); - result = result && initGame(); + if (!initSDL()) { + return false; + } else if (!initGame()) { + return false; + } + settings_init(); initMainMenu(); @@ -349,7 +352,7 @@ init(void) gGameState = MENU; - return result; + return true; } static bool diff --git a/src/util.c b/src/util.c index 3aa6369..846b0fa 100644 --- a/src/util.c +++ b/src/util.c @@ -96,6 +96,7 @@ log_print(FILE *out, char tstamp[10]; timestamp(tstamp, 10); +#ifdef DEBUG #ifndef _WIN32 if (out == stdout || out == stderr) { fprintf(out, "\033[34m[%s]", tstamp); @@ -111,9 +112,15 @@ log_print(FILE *out, } else { fprintf(out, "[%s][%5s][%20s:%-3d][%20s()] ", tstamp, prefix, file, line, function); } -#else +#else // _WIN32 fprintf(out, "[%s][%5s][%20s:%-3d][%20s()] ", tstamp, prefix, file, line, function); -#endif +#endif // _WIN32 +#else // DEBUG + UNUSED(prefix); + UNUSED(file); + UNUSED(line); + UNUSED(function); +#endif // DEBUG va_start(args, fmt); vfprintf(out, fmt, args); va_end(args);