diff --git a/src/error_handling.c b/src/error_handling.c index 92c0659..aee0e2c 100644 --- a/src/error_handling.c +++ b/src/error_handling.c @@ -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); } diff --git a/src/error_handling.h b/src/error_handling.h index 5e47d13..a5fe13e 100644 --- a/src/error_handling.h +++ b/src/error_handling.h @@ -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