Convert quit from stick to jailbreak exception.

The goal is to replace all stikcy exceptions jail break exceptions and
make the exeption handling of Lua a bit more like normal C++ exception
handling.
This commit is contained in:
Mark de Wever 2011-03-27 20:55:18 +00:00
parent bed0fa3175
commit fe33804d90
2 changed files with 13 additions and 3 deletions

View file

@ -23,7 +23,6 @@ char const *game::exception::sticky;
void game::exception::rethrow()
{
if (!sticky) return;
if (strcmp(sticky, "quit") == 0) throw CVideo::quit();
if (strcmp(sticky, "load game") == 0) throw game::load_game_exception();
if (strcmp(sticky, "end level") == 0) throw end_level_exception(QUIT);
throw game::exception("Unknown exception", "unknown");

View file

@ -17,6 +17,7 @@
#include "events.hpp"
#include "exceptions.hpp"
#include "lua_jailbreak_exception.hpp"
#include <boost/utility.hpp>
@ -72,9 +73,19 @@ class CVideo : private boost::noncopyable {
error() : game::error("Video initialization failed") {}
};
struct quit : public game::exception
class quit
: public tlua_jailbreak_exception
{
quit() : game::exception("Exit game", "quit") {}
public:
quit()
: tlua_jailbreak_exception()
{
}
private:
IMPLEMENT_LUA_JAILBREAK_EXCEPTION(quit)
};
//functions to allow changing video modes when 16BPP is emulated