The Battle for Wesnoth  1.15.2+dev
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
replay_controller Class Reference

#include <replay_controller.hpp>

Inheritance diagram for replay_controller:
Inheritance graph

Classes

class  replay_stop_condition
 

Public Member Functions

 replay_controller (play_controller &controller, bool control_view, const std::shared_ptr< config > &reset_state, const std::function< void()> &on_end_replay=nop)
 
 ~replay_controller ()
 
void play_replay ()
 
void stop_replay ()
 
void replay_next_turn ()
 
void replay_next_side ()
 
void replay_next_move ()
 
REPLAY_RETURN play_side_impl ()
 
bool recorder_at_end () const
 
bool should_stop () const
 
bool can_execute_command (const hotkey::hotkey_command &cmd, int index) const
 
bool is_controlling_view () const
 
bool allow_reset_replay () const
 
const std::shared_ptr< config > & get_reset_state () const
 
void return_to_play_side (bool r=true)
 
void replay_show_everything ()
 
void replay_show_each ()
 
void replay_show_team1 ()
 
void update_teams ()
 
void update_viewing_player ()
 
bool see_all ()
 
- Public Member Functions inherited from events::observer
virtual ~observer ()
 

Static Public Member Functions

static void nop ()
 

Private Types

enum  REPLAY_VISION { HUMAN_TEAM, CURRENT_TEAM, SHOW_ALL }
 

Private Member Functions

void add_replay_theme ()
 
void init ()
 
void update_gui ()
 
void handle_generic_event (const std::string &name) override
 
void update_enabled_buttons ()
 Refresh the states of the replay-control buttons, this will cause the hotkey framework to query can_execute_command() for each button and then set the enabled/disabled state based on that query. More...
 

Private Attributes

play_controllercontroller_
 
std::unique_ptr< replay_stop_conditionstop_condition_
 
events::command_disabler disabler_
 
boost::optional< REPLAY_VISIONvision_
 
std::shared_ptr< configreset_state_
 
std::function< void()> on_end_replay_
 
bool return_to_play_side_
 

Detailed Description

Definition at line 24 of file replay_controller.hpp.

Member Enumeration Documentation

◆ REPLAY_VISION

Enumerator
HUMAN_TEAM 
CURRENT_TEAM 
SHOW_ALL 

Definition at line 81 of file replay_controller.hpp.

Constructor & Destructor Documentation

◆ replay_controller()

replay_controller::replay_controller ( play_controller controller,
bool  control_view,
const std::shared_ptr< config > &  reset_state,
const std::function< void()> &  on_end_replay = nop 
)

◆ ~replay_controller()

replay_controller::~replay_controller ( )

Member Function Documentation

◆ add_replay_theme()

void replay_controller::add_replay_theme ( )
private

◆ allow_reset_replay()

bool replay_controller::allow_reset_replay ( ) const
inline

Definition at line 51 of file replay_controller.hpp.

References reset_state_.

Referenced by can_execute_command().

◆ can_execute_command()

bool replay_controller::can_execute_command ( const hotkey::hotkey_command cmd,
int  index 
) const

◆ get_reset_state()

const std::shared_ptr<config>& replay_controller::get_reset_state ( ) const
inline

Definition at line 52 of file replay_controller.hpp.

References reset_state_.

◆ handle_generic_event()

void replay_controller::handle_generic_event ( const std::string &  name)
overrideprivatevirtual

◆ init()

void replay_controller::init ( )
private

Referenced by return_to_play_side().

◆ is_controlling_view()

bool replay_controller::is_controlling_view ( ) const
inline

Definition at line 50 of file replay_controller.hpp.

References vision_.

Referenced by can_execute_command().

◆ nop()

static void replay_controller::nop ( )
inlinestatic

◆ play_replay()

void replay_controller::play_replay ( )

◆ play_side_impl()

REPLAY_RETURN replay_controller::play_side_impl ( )

◆ recorder_at_end()

bool replay_controller::recorder_at_end ( ) const

Definition at line 161 of file replay_controller.cpp.

References replay::at_end(), and resources::recorder.

Referenced by can_execute_command(), and nop().

◆ replay_next_move()

void replay_controller::replay_next_move ( )

◆ replay_next_side()

void replay_controller::replay_next_side ( )

◆ replay_next_turn()

void replay_controller::replay_next_turn ( )

◆ replay_show_each()

void replay_controller::replay_show_each ( )

◆ replay_show_everything()

void replay_controller::replay_show_everything ( )

◆ replay_show_team1()

void replay_controller::replay_show_team1 ( )

◆ return_to_play_side()

void replay_controller::return_to_play_side ( bool  r = true)
inline

◆ see_all()

bool replay_controller::see_all ( )

Definition at line 269 of file replay_controller.cpp.

References SHOW_ALL, and vision_.

Referenced by events::menu_handler::current_unit(), and return_to_play_side().

◆ should_stop()

bool replay_controller::should_stop ( ) const
inline

Definition at line 48 of file replay_controller.hpp.

References can_execute_command(), utf8::index(), and stop_condition_.

Referenced by can_execute_command().

◆ stop_replay()

void replay_controller::stop_replay ( )

◆ update_enabled_buttons()

void replay_controller::update_enabled_buttons ( )
private

Refresh the states of the replay-control buttons, this will cause the hotkey framework to query can_execute_command() for each button and then set the enabled/disabled state based on that query.

The ids for the associated buttons are: "button-playreplay", "button-stopreplay", "button-resetreplay", "button-nextturn", "button-nextside", and "button-nextmove".

Definition at line 144 of file replay_controller.cpp.

References controller_, play_controller::get_display(), display::invalidate_theme(), and display::redraw_everything().

Referenced by play_replay(), play_side_impl(), replay_next_move(), replay_next_side(), replay_next_turn(), return_to_play_side(), and stop_replay().

◆ update_gui()

void replay_controller::update_gui ( )
private

◆ update_teams()

void replay_controller::update_teams ( )

◆ update_viewing_player()

void replay_controller::update_viewing_player ( )

Member Data Documentation

◆ controller_

play_controller& replay_controller::controller_
private

◆ disabler_

events::command_disabler replay_controller::disabler_
private

Definition at line 79 of file replay_controller.hpp.

◆ on_end_replay_

std::function<void()> replay_controller::on_end_replay_
private

Definition at line 89 of file replay_controller.hpp.

Referenced by play_side_impl().

◆ reset_state_

std::shared_ptr<config> replay_controller::reset_state_
private

Definition at line 88 of file replay_controller.hpp.

Referenced by allow_reset_replay(), and get_reset_state().

◆ return_to_play_side_

bool replay_controller::return_to_play_side_
private

Definition at line 90 of file replay_controller.hpp.

Referenced by play_side_impl(), and return_to_play_side().

◆ stop_condition_

std::unique_ptr<replay_stop_condition> replay_controller::stop_condition_
private

◆ vision_

boost::optional<REPLAY_VISION> replay_controller::vision_
private

The documentation for this class was generated from the following files: