Fixed log prints in release mode and some better fail handling.
This commit is contained in:
parent
b219c76e81
commit
fcf1f24547
11
src/main.c
11
src/main.c
|
@ -339,9 +339,12 @@ resetGame(void)
|
||||||
static bool
|
static bool
|
||||||
init(void)
|
init(void)
|
||||||
{
|
{
|
||||||
bool result = true;
|
if (!initSDL()) {
|
||||||
result = result && initSDL();
|
return false;
|
||||||
result = result && initGame();
|
} else if (!initGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
settings_init();
|
settings_init();
|
||||||
initMainMenu();
|
initMainMenu();
|
||||||
|
|
||||||
|
@ -349,7 +352,7 @@ init(void)
|
||||||
|
|
||||||
gGameState = MENU;
|
gGameState = MENU;
|
||||||
|
|
||||||
return result;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
11
src/util.c
11
src/util.c
|
@ -96,6 +96,7 @@ log_print(FILE *out,
|
||||||
char tstamp[10];
|
char tstamp[10];
|
||||||
|
|
||||||
timestamp(tstamp, 10);
|
timestamp(tstamp, 10);
|
||||||
|
#ifdef DEBUG
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (out == stdout || out == stderr) {
|
if (out == stdout || out == stderr) {
|
||||||
fprintf(out, "\033[34m[%s]", tstamp);
|
fprintf(out, "\033[34m[%s]", tstamp);
|
||||||
|
@ -111,9 +112,15 @@ log_print(FILE *out,
|
||||||
} else {
|
} else {
|
||||||
fprintf(out, "[%s][%5s][%20s:%-3d][%20s()] ", tstamp, prefix, file, line, function);
|
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);
|
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);
|
va_start(args, fmt);
|
||||||
vfprintf(out, fmt, args);
|
vfprintf(out, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
Loading…
Reference in New Issue