00001 /* $Id: game_errors.hpp 52981 2012-02-07 23:50:30Z fendrin $ */ 00002 /* 00003 Copyright (C) 2003 by David White <dave@whitevine.net> 00004 Copyright (C) 2005 - 2012 by Yann Dirson <ydirson@altern.org> 00005 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY. 00013 00014 See the COPYING file for more details. 00015 */ 00016 #ifndef GAME_ERRORS_HPP_INCLUDED 00017 #define GAME_ERRORS_HPP_INCLUDED 00018 00019 #include "exceptions.hpp" 00020 #include "lua_jailbreak_exception.hpp" 00021 00022 namespace game { 00023 00024 struct mp_server_error : public error { 00025 mp_server_error(const std::string& msg) : error("MP server error: " + msg) {} 00026 }; 00027 00028 /** 00029 * Error used when game loading fails. 00030 */ 00031 struct load_game_failed : public error { 00032 load_game_failed() {} 00033 load_game_failed(const std::string& msg) : error("load_game_failed: " + msg) {} 00034 }; 00035 00036 /** 00037 * Error used when game saving fails. 00038 */ 00039 struct save_game_failed : public error { 00040 save_game_failed() {} 00041 save_game_failed(const std::string& msg) : error("save_game_failed: " + msg) {} 00042 }; 00043 00044 /** 00045 * Error used for any general game error, e.g. data files are corrupt. 00046 */ 00047 struct game_error : public error { 00048 game_error(const std::string& msg) : error("game_error: " + msg) {} 00049 }; 00050 00051 /** 00052 * Exception used to signal that the user has decided to abort a game, 00053 * and to load another game instead. 00054 */ 00055 class load_game_exception 00056 : public tlua_jailbreak_exception 00057 { 00058 public: 00059 00060 load_game_exception() 00061 : tlua_jailbreak_exception() 00062 { 00063 } 00064 00065 load_game_exception( 00066 const std::string& game_ 00067 , const bool show_replay_ 00068 , const bool cancel_orders_ 00069 , const bool select_difficulty_ 00070 , const std::string& difficulty_) 00071 : tlua_jailbreak_exception() 00072 { 00073 game = game_; 00074 show_replay = show_replay_; 00075 cancel_orders = cancel_orders_; 00076 select_difficulty = select_difficulty_; 00077 difficulty = difficulty_; 00078 } 00079 00080 static std::string game; 00081 static bool show_replay; 00082 static bool cancel_orders; 00083 static bool select_difficulty; 00084 static std::string difficulty; 00085 00086 private: 00087 00088 IMPLEMENT_LUA_JAILBREAK_EXCEPTION(load_game_exception) 00089 }; 00090 00091 } 00092 00093 #endif
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:52 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |