mirror of
https://github.com/thepigeongenerator/sdl_template.git
synced 2025-12-17 05:55:47 +01:00
fix: error really should exit immediately when called
This commit is contained in:
@@ -50,5 +50,8 @@ void error(gamestatus error_code, char const* fmt, ...) {
|
|||||||
write_args(buf, fmt);
|
write_args(buf, fmt);
|
||||||
(void)fprintf(stderr, "\033[91mE: %s\033[0m\n", buf);
|
(void)fprintf(stderr, "\033[91mE: %s\033[0m\n", buf);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "something went wrong! :O", buf, NULL);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "something went wrong! :O", buf, NULL);
|
||||||
|
|
||||||
|
// set status, but exit immediately, as code is not allowed to execute beyond this point
|
||||||
status = error_code;
|
status = error_code;
|
||||||
|
exit(status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,4 +31,4 @@ gamestatus get_gamestatus(void); // gets the current status of the game
|
|||||||
void debug(char const*, ...); // prints a debug message to stdout if the DEBUG environment variable is set, otherwise the call is ignored.
|
void debug(char const*, ...); // prints a debug message to stdout if the DEBUG environment variable is set, otherwise the call is ignored.
|
||||||
void info(char const*, ...); // prints an info message to stdout
|
void info(char const*, ...); // prints an info message to stdout
|
||||||
void warn(char const*, ...); // prints a warning message to stderr
|
void warn(char const*, ...); // prints a warning message to stderr
|
||||||
void error(gamestatus, char const*, ...); // prints an error message to stderr
|
void error(gamestatus, char const*, ...); // prints an error message to stderr before exiting
|
||||||
|
|||||||
Reference in New Issue
Block a user