The Battle for Wesnoth  1.19.0-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:

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 ()
 
void play_side_impl ()
 
bool recorder_at_end () const
 
bool should_stop () const
 
bool can_execute_command (const hotkey::ui_command &cmd) 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_
 
std::optional< REPLAY_VISIONvision_
 
std::shared_ptr< configreset_state_
 When the "Reset" button is pressed reset the gamestate to this serialized gamestaten, the initial gamestate. More...
 
std::function< void()> on_end_replay_
 Called when there are no more moves in the [replay] to process. More...
 
bool return_to_play_side_
 Used by unit tests. More...
 

Detailed Description

Definition at line 21 of file replay_controller.hpp.

Member Enumeration Documentation

◆ REPLAY_VISION

Enumerator
HUMAN_TEAM 
CURRENT_TEAM 
SHOW_ALL 

Definition at line 80 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 50 of file replay_controller.hpp.

References reset_state_.

Referenced by can_execute_command().

◆ can_execute_command()

bool replay_controller::can_execute_command ( const hotkey::ui_command cmd) const

◆ get_reset_state()

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

Definition at line 51 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

◆ is_controlling_view()

bool replay_controller::is_controlling_view ( ) const
inline

Definition at line 47 of file replay_controller.hpp.

References vision_.

Referenced by can_execute_command().

◆ nop()

static void replay_controller::nop ( )
inlinestatic

Definition at line 32 of file replay_controller.hpp.

◆ play_replay()

void replay_controller::play_replay ( )

◆ play_side_impl()

void replay_controller::play_side_impl ( )

◆ recorder_at_end()

bool replay_controller::recorder_at_end ( ) const

Definition at line 150 of file replay_controller.cpp.

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

Referenced by can_execute_command().

◆ 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

Definition at line 52 of file replay_controller.hpp.

References return_to_play_side_.

◆ see_all()

bool replay_controller::see_all ( )

Definition at line 257 of file replay_controller.cpp.

References SHOW_ALL, and vision_.

◆ should_stop()

bool replay_controller::should_stop ( ) const
inline

Definition at line 45 of file replay_controller.hpp.

References 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 134 of file replay_controller.cpp.

References controller_, play_controller::get_display(), and display::queue_rerender().

Referenced by play_replay(), play_side_impl(), replay_next_move(), replay_next_side(), replay_next_turn(), 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 78 of file replay_controller.hpp.

◆ on_end_replay_

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

Called when there are no more moves in the [replay] to process.

Definition at line 91 of file replay_controller.hpp.

Referenced by play_side_impl().

◆ reset_state_

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

When the "Reset" button is pressed reset the gamestate to this serialized gamestaten, the initial gamestate.

Definition at line 89 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

Used by unit tests.

Definition at line 93 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_

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

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