replay_controller.hpp

Go to the documentation of this file.
00001 /* $Id: replay_controller.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2006 - 2012 by Joerg Hinrichs <joerg.hinrichs@alice-dsl.de>
00004    wesnoth playlevel 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 #ifndef REPLAY_CONTROLLER_H_INCLUDED
00018 #define REPLAY_CONTROLLER_H_INCLUDED
00019 
00020 #include "game_end_exceptions.hpp"
00021 #include "gamestatus.hpp"
00022 #include "play_controller.hpp"
00023 
00024 #include <vector>
00025 
00026 class video;
00027 
00028 class replay_controller : public play_controller
00029 {
00030 public:
00031     replay_controller(const config& level, game_state& state_of_game,
00032         const int ticks, const int num_turns, const config& game_config, CVideo& video);
00033     virtual ~replay_controller();
00034 
00035     virtual bool can_execute_command(hotkey::HOTKEY_COMMAND command, int index=-1) const;
00036 
00037     //event handlers
00038     virtual void preferences();
00039     virtual void show_statistics();
00040     void play_replay();
00041     void reset_replay();
00042     void stop_replay();
00043     void replay_next_turn();
00044     void replay_next_side();
00045     void process_oos(const std::string& msg) const;
00046     void replay_show_everything();
00047     void replay_show_each();
00048     void replay_show_team1();
00049     void replay_skip_animation();
00050 
00051     virtual void force_end_turn() {}
00052     virtual void force_end_level(LEVEL_RESULT) {}
00053     virtual void check_end_level() {}
00054 
00055     std::vector<team> teams_start_;
00056 
00057 protected:
00058     virtual void init_gui();
00059 
00060 private:
00061     void init();
00062     virtual void play_turn();
00063     virtual void play_side(const unsigned int team_index, bool save);
00064     void update_teams();
00065     void update_gui();
00066     void init_replay_display();
00067     void rebuild_replay_theme();
00068     void handle_generic_event(const std::string& /*name*/);
00069 
00070     void reset_replay_ui();
00071     void update_replay_ui();
00072 
00073     void replay_ui_playback_should_start();
00074     void replay_ui_playback_should_stop();
00075 
00076     gui::button* play_button();
00077     gui::button* stop_button();
00078     gui::button* reset_button();
00079     gui::button* play_turn_button();
00080     gui::button* play_side_button();
00081 
00082     bool replay_ui_has_all_buttons() {
00083         return play_button() && stop_button() && reset_button() &&
00084                play_turn_button() && play_side_button();
00085     }
00086 
00087     game_state gamestate_start_;
00088     unit_map units_start_;
00089     tod_manager tod_manager_start_;
00090 
00091     unsigned int current_turn_;
00092     int delay_;
00093     bool is_playing_;
00094 
00095     bool show_everything_;
00096     unsigned int show_team_;
00097 };
00098 
00099 
00100 LEVEL_RESULT play_replay_level(const config& terrain_config,
00101         const config* level, CVideo& video,
00102         game_state& state_of_game);
00103 
00104 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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