#include "game_session.hpp"
#include "file_system.hpp"
#include "physfs/physfs_sdl.hpp"
+#include "exceptions.hpp"
SDL_Surface* screen = 0;
JoystickKeyboardController* main_controller = 0;
config->record_demo = argv[++i];
} else if(arg == "--help") {
print_usage(argv[0]);
- throw std::runtime_error("");
+ throw graceful_shutdown();
} else if(arg == "--version") {
std::cerr << PACKAGE_NAME << " " << PACKAGE_VERSION << "\n";
- throw std::runtime_error("");
+ throw graceful_shutdown();
} else if(arg[0] != '-') {
config->start_level = arg;
} else {
while(SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_QUIT:
- throw std::runtime_error("received window close");
+ throw graceful_shutdown();
case SDL_KEYDOWN:
case SDL_JOYBUTTONDOWN:
case SDL_MOUSEBUTTONDOWN:
} else {
// normal game
title();
- }
+ }
+ } catch(graceful_shutdown& e) {
} catch(std::exception& e) {
std::cerr << "Unexpected exception: " << e.what() << std::endl;
return 1;