#include <replay_controller.hpp>
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 () |
![]() | |
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_controller & | controller_ |
std::unique_ptr< replay_stop_condition > | stop_condition_ |
events::command_disabler | disabler_ |
std::optional< REPLAY_VISION > | vision_ |
std::shared_ptr< config > | reset_state_ |
std::function< void()> | on_end_replay_ |
bool | return_to_play_side_ |
Definition at line 23 of file replay_controller.hpp.
|
private |
Enumerator | |
---|---|
HUMAN_TEAM | |
CURRENT_TEAM | |
SHOW_ALL |
Definition at line 82 of file replay_controller.hpp.
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 |
||
) |
Definition at line 66 of file replay_controller.cpp.
References events::generic_event::attach_handler(), controller_, play_controller::get_display(), display::get_theme(), HUMAN_TEAM, display::queue_rerender(), theme::theme_reset_event(), and vision_.
Referenced by nop().
replay_controller::~replay_controller | ( | ) |
Definition at line 81 of file replay_controller.cpp.
References controller_, events::generic_event::detach_handler(), play_controller::get_display(), display::get_theme(), play_controller::is_skipping_replay(), display::queue_rerender(), theme::theme_reset_event(), and play_controller::toggle_skipping_replay().
Referenced by nop().
|
private |
Definition at line 89 of file replay_controller.cpp.
References controller_, play_controller::get_display(), display::get_theme(), theme::get_theme_config(), theme::modify(), config::optional_child(), and play_controller::theme().
Referenced by handle_generic_event(), and return_to_play_side().
|
inline |
Definition at line 52 of file replay_controller.hpp.
References reset_state_.
Referenced by can_execute_command().
bool replay_controller::can_execute_command | ( | const hotkey::hotkey_command & | cmd, |
int | index | ||
) | const |
Definition at line 201 of file replay_controller.cpp.
References allow_reset_replay(), hotkey::hotkey_command::command, events::commands_disabled, hotkey::HOTKEY_REPLAY_NEXT_MOVE, hotkey::HOTKEY_REPLAY_NEXT_SIDE, hotkey::HOTKEY_REPLAY_NEXT_TURN, hotkey::HOTKEY_REPLAY_PLAY, hotkey::HOTKEY_REPLAY_RESET, hotkey::HOTKEY_REPLAY_SHOW_EACH, hotkey::HOTKEY_REPLAY_SHOW_EVERYTHING, hotkey::HOTKEY_REPLAY_SHOW_TEAM1, hotkey::HOTKEY_REPLAY_SKIP_ANIMATION, hotkey::HOTKEY_REPLAY_STOP, is_controlling_view(), recorder_at_end(), and should_stop().
Referenced by playsingle_controller::hotkey_handler::can_execute_command(), and should_stop().
|
inline |
Definition at line 53 of file replay_controller.hpp.
References reset_state_.
|
overrideprivatevirtual |
Implements events::observer.
Definition at line 141 of file replay_controller.cpp.
References add_replay_theme(), controller_, display::find_action_button(), play_controller::get_display(), and play_controller::is_skipping_replay().
Referenced by return_to_play_side().
|
private |
Referenced by return_to_play_side().
|
inline |
Definition at line 49 of file replay_controller.hpp.
References vision_.
Referenced by can_execute_command().
|
inlinestatic |
Definition at line 34 of file replay_controller.hpp.
References play_replay(), play_side_impl(), recorder_at_end(), replay_controller(), replay_next_move(), replay_next_side(), replay_next_turn(), stop_replay(), and ~replay_controller().
void replay_controller::play_replay | ( | ) |
Definition at line 125 of file replay_controller.cpp.
References stop_condition_, and update_enabled_buttons().
Referenced by nop(), and playsingle_controller::hotkey_handler::play_replay().
REPLAY_RETURN replay_controller::play_side_impl | ( | ) |
Definition at line 157 of file replay_controller.cpp.
References controller_, play_controller::current_side(), do_replay(), play_controller::gamestate(), on_end_replay_, controller_base::play_slice(), resources::recorder, REPLAY_FOUND_END_MOVE, REPLAY_FOUND_END_TURN, REPLAY_FOUND_INIT_TURN, REPLAY_RETURN_AT_END, return_to_play_side_, stop_condition_, stop_replay(), game_state::tod_manager_, tod_manager::turn(), and update_enabled_buttons().
Referenced by nop().
bool replay_controller::recorder_at_end | ( | ) | const |
Definition at line 152 of file replay_controller.cpp.
References replay::at_end(), and resources::recorder.
Referenced by can_execute_command(), and nop().
void replay_controller::replay_next_move | ( | ) |
Definition at line 118 of file replay_controller.cpp.
References stop_condition_, and update_enabled_buttons().
Referenced by nop(), and playsingle_controller::hotkey_handler::replay_next_move().
void replay_controller::replay_next_side | ( | ) |
Definition at line 112 of file replay_controller.cpp.
References stop_condition_, and update_enabled_buttons().
Referenced by nop(), and playsingle_controller::hotkey_handler::replay_next_side().
void replay_controller::replay_next_turn | ( | ) |
Definition at line 106 of file replay_controller.cpp.
References controller_, play_controller::gamestate(), stop_condition_, game_state::tod_manager_, tod_manager::turn(), and update_enabled_buttons().
Referenced by nop(), and playsingle_controller::hotkey_handler::replay_next_turn().
void replay_controller::replay_show_each | ( | ) |
Definition at line 233 of file replay_controller.cpp.
References CURRENT_TEAM, update_teams(), and vision_.
Referenced by playsingle_controller::hotkey_handler::replay_show_each(), and return_to_play_side().
void replay_controller::replay_show_everything | ( | ) |
Definition at line 227 of file replay_controller.cpp.
References SHOW_ALL, update_teams(), and vision_.
Referenced by playsingle_controller::hotkey_handler::replay_show_everything(), and return_to_play_side().
void replay_controller::replay_show_team1 | ( | ) |
Definition at line 239 of file replay_controller.cpp.
References HUMAN_TEAM, update_teams(), and vision_.
Referenced by playsingle_controller::hotkey_handler::replay_show_team1(), and return_to_play_side().
|
inline |
Definition at line 54 of file replay_controller.hpp.
References add_replay_theme(), handle_generic_event(), init(), replay_show_each(), replay_show_everything(), replay_show_team1(), return_to_play_side_, see_all(), update_enabled_buttons(), update_gui(), update_teams(), and update_viewing_player().
bool replay_controller::see_all | ( | ) |
Definition at line 258 of file replay_controller.cpp.
References SHOW_ALL, and vision_.
Referenced by events::menu_handler::current_unit(), and return_to_play_side().
|
inline |
Definition at line 47 of file replay_controller.hpp.
References can_execute_command(), utf8::index(), and stop_condition_.
Referenced by can_execute_command().
void replay_controller::stop_replay | ( | ) |
Definition at line 100 of file replay_controller.cpp.
References stop_condition_, and update_enabled_buttons().
Referenced by nop(), play_side_impl(), and playsingle_controller::hotkey_handler::stop_replay().
|
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 136 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(), return_to_play_side(), and stop_replay().
|
private |
Definition at line 131 of file replay_controller.cpp.
References controller_, play_controller::get_display(), and display::queue_rerender().
Referenced by return_to_play_side(), and update_teams().
void replay_controller::update_teams | ( | ) |
Definition at line 245 of file replay_controller.cpp.
References controller_, play_controller::get_display(), display::invalidate_all(), update_gui(), and update_viewing_player().
Referenced by replay_show_each(), replay_show_everything(), replay_show_team1(), and return_to_play_side().
void replay_controller::update_viewing_player | ( | ) |
Definition at line 252 of file replay_controller.cpp.
References controller_, play_controller::current_side(), game_state::first_human_team_, play_controller::gamestate(), HUMAN_TEAM, SHOW_ALL, play_controller::update_gui_to_player(), and vision_.
Referenced by return_to_play_side(), and update_teams().
|
private |
Definition at line 78 of file replay_controller.hpp.
Referenced by add_replay_theme(), handle_generic_event(), play_side_impl(), replay_controller(), replay_next_turn(), update_enabled_buttons(), update_gui(), update_teams(), update_viewing_player(), and ~replay_controller().
|
private |
Definition at line 80 of file replay_controller.hpp.
|
private |
Definition at line 90 of file replay_controller.hpp.
Referenced by play_side_impl().
|
private |
Definition at line 89 of file replay_controller.hpp.
Referenced by allow_reset_replay(), and get_reset_state().
|
private |
Definition at line 91 of file replay_controller.hpp.
Referenced by play_side_impl(), and return_to_play_side().
|
private |
Definition at line 79 of file replay_controller.hpp.
Referenced by play_replay(), play_side_impl(), replay_next_move(), replay_next_side(), replay_next_turn(), should_stop(), and stop_replay().
|
private |
Definition at line 88 of file replay_controller.hpp.
Referenced by is_controlling_view(), replay_controller(), replay_show_each(), replay_show_everything(), replay_show_team1(), see_all(), and update_viewing_player().