Fixed log prints in release mode and some better fail handling.

This commit is contained in:
Linus Probert 2018-05-04 01:22:40 +10:00
parent b219c76e81
commit fcf1f24547
2 changed files with 16 additions and 6 deletions

View File

@ -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

View File

@ -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);