game_end_exceptions.hpp

Go to the documentation of this file.
00001 /* $Id: game_end_exceptions.hpp 52928 2012-02-06 18:12:44Z mordante $ */
00002 /*
00003    Copyright (C) 2006 - 2012 by Joerg Hinrichs <joerg.hinrichs@alice-dsl.de>
00004    wesnoth playturn Copyright (C) 2003 by David White <dave@whitevine.net>
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 
00017 /**
00018  * @file
00019  * Contains the exception interfaces used to signal
00020  * completion of a scenario, campaign or turn.
00021  */
00022 
00023 #ifndef GAME_END_EXCEPTIONS_HPP_INCLUDED
00024 #define GAME_END_EXCEPTIONS_HPP_INCLUDED
00025 
00026 #include "lua_jailbreak_exception.hpp"
00027 
00028 #include <string>
00029 
00030 class config;
00031 
00032 enum LEVEL_RESULT {
00033     NONE,
00034     VICTORY,
00035     DEFEAT,
00036     QUIT,
00037     OBSERVER_END,
00038     SKIP_TO_LINGER
00039 };
00040 
00041 /**
00042  * Exception used to signal the end of a player turn.
00043  */
00044 class end_turn_exception
00045     : public tlua_jailbreak_exception
00046 {
00047 public:
00048 
00049     end_turn_exception(unsigned r = 0)
00050         : tlua_jailbreak_exception()
00051         , redo(r)
00052     {
00053     }
00054 
00055     unsigned redo;
00056 
00057 private:
00058 
00059     IMPLEMENT_LUA_JAILBREAK_EXCEPTION(end_turn_exception)
00060 };
00061 
00062 /**
00063  * Exception used to signal the end of a scenario.
00064  */
00065 class end_level_exception
00066     : public tlua_jailbreak_exception
00067 {
00068 public:
00069 
00070     end_level_exception(LEVEL_RESULT res)
00071         : tlua_jailbreak_exception()
00072         , result(res)
00073     {
00074     }
00075 
00076     LEVEL_RESULT result;
00077 
00078 private:
00079 
00080     IMPLEMENT_LUA_JAILBREAK_EXCEPTION(end_level_exception)
00081 };
00082 
00083 
00084 /**
00085  * Additional information on the game outcome which can be provided by WML.
00086  */
00087 struct end_level_data
00088 {
00089     end_level_data();
00090 
00091     bool carryover_report;             /**< Should a summary of the scenario outcome be displayed? */
00092     bool prescenario_save;             /**< Should a prescenario be created the next game? */
00093     bool replay_save;                  /**< Should a replay save be made? */
00094     bool linger_mode;                  /**< Should linger mode be invoked? */
00095     bool gold_bonus;                   /**< Should early-finish bonus be applied? */
00096     int carryover_percentage;          /**< How much gold is carried over to next scenario. */
00097     bool carryover_add;                /**< Add or replace next scenario's minimum starting gold. */
00098     std::string custom_endlevel_music; /**< Custom short music played at the end. */
00099     bool reveal_map;                   /**< Should we reveal map when game is ended? (Multiplayer only) */
00100     bool disabled;                     /**< Limits execution of tag [endlevel] to a single time > */
00101 
00102     void write(config& cfg) const;
00103 
00104     void read(const config& cfg);
00105 };
00106 
00107 #endif /* ! GAME_END_EXCEPTIONS_HPP_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:52 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs