fix: error really should exit immediately when called

This commit is contained in:
2025-02-13 15:33:23 +01:00
parent 6f483cb0f5
commit 8b5c4429c8
2 changed files with 4 additions and 1 deletions

View File

@@ -50,5 +50,8 @@ void error(gamestatus error_code, char const* fmt, ...) {
write_args(buf, fmt);
(void)fprintf(stderr, "\033[91mE: %s\033[0m\n", buf);
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;
exit(status);
}

View File

@@ -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 info(char const*, ...); // prints an info message to stdout
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