Do not close game if custom level has assets issues

It's quite rude to close the game entirely if there is trouble with
assets. Instead, just unload the assets and gracefully return to the
title screen.
This commit is contained in:
Misa
2021-08-06 20:57:34 -07:00
committed by Ethan Lee
parent ed9cb4ca6d
commit 8dc5d69ef3
12 changed files with 118 additions and 46 deletions

View File

@@ -483,7 +483,19 @@ int main(int argc, char *argv[])
game.init();
// This loads music too...
graphics.reloadresources();
if (!graphics.reloadresources())
{
/* Something wrong with the default assets? We can't use them to
* display the error message, and we have to bail. */
SDL_ShowSimpleMessageBox(
SDL_MESSAGEBOX_ERROR,
graphics.error_title,
graphics.error,
NULL
);
VVV_exit(1);
}
game.gamestate = PRELOADER;