#include <replay.hpp>
Public Types | |
enum | DATA_TYPE { ALL_DATA , NON_UNDO_DATA } |
enum | MARK_SENT { MARK_AS_UNSENT , MARK_AS_SENT } |
Public Member Functions | |
replay (replay_recorder_base &base) | |
void | add_start () |
void | add_surrender (int side_number) |
void | add_countdown_update (int value, int team) |
void | add_synced_command (const std::string &name, const config &command) |
void | init_side () |
config & | get_last_real_command () |
void | user_input (const std::string &name, const config &input, int from_side) |
adds a user_input to the replay More... | |
void | add_label (const terrain_label *) |
void | clear_labels (const std::string &, bool) |
void | add_rename (const std::string &name, const map_location &loc) |
void | end_turn (int next_player_number) |
void | add_unit_checksum (const map_location &loc, config &cfg) |
void | add_log_data (const std::string &key, const std::string &var) |
void | add_log_data (const std::string &category, const std::string &key, const std::string &var) |
void | add_log_data (const std::string &category, const std::string &key, const config &c) |
bool | add_chat_message_location () |
adds a chat message if it wasn't added yet. More... | |
bool | add_chat_message_location (int pos) |
void | speak (const config &cfg) |
const std::vector< chat_msg > & | build_chat_log () const |
config | get_unsent_commands (DATA_TYPE data_type) |
void | undo () |
void | undo_cut (config &dst) |
void | redo (const config &dst, bool set_to_end=false) |
void | start_replay () |
void | revert_action () |
config * | get_next_action () |
config * | peek_next_action () |
bool | at_end () const |
void | set_to_end () |
bool | empty () const |
void | add_config (const config &cfg, MARK_SENT mark=MARK_AS_UNSENT) |
int | ncommands () const |
bool | add_start_if_not_there_yet () |
void | delete_upcoming_commands () |
Static Public Member Functions | |
static void | process_error (const std::string &msg) |
Private Member Functions | |
void | add_chat_log_entry (const config &speak, std::back_insert_iterator< std::vector< chat_msg >> &i) const |
config & | command (int) const |
void | remove_command (int) |
config & | add_command () |
Adds a new empty command to the command list at the end. More... | |
config & | add_nonundoable_command () |
adds a new command to the command list at the current position. More... | |
Private Attributes | |
replay_recorder_base * | base_ |
int | sent_upto_ |
std::vector< int > | message_locations |
Definition at line 58 of file replay.hpp.
enum replay::DATA_TYPE |
Enumerator | |
---|---|
ALL_DATA | |
NON_UNDO_DATA |
Definition at line 107 of file replay.hpp.
enum replay::MARK_SENT |
Enumerator | |
---|---|
MARK_AS_UNSENT | |
MARK_AS_SENT |
Definition at line 132 of file replay.hpp.
|
explicit |
Definition at line 182 of file replay.cpp.
|
private |
Definition at line 358 of file replay.cpp.
References prefs::get(), and i.
Referenced by build_chat_log().
bool replay::add_chat_message_location | ( | ) |
adds a chat message if it wasn't added yet.
Definition at line 334 of file replay.cpp.
References base_, and replay_recorder_base::get_pos().
Referenced by speak().
bool replay::add_chat_message_location | ( | int | pos | ) |
Definition at line 339 of file replay.cpp.
References base_, replay_recorder_base::get_command_at(), config::has_child(), and message_locations.
|
private |
Adds a new empty command to the command list at the end.
Definition at line 587 of file replay.cpp.
References replay_recorder_base::add_child(), at_end(), base_, and set_to_end().
Referenced by add_countdown_update(), add_rename(), add_start(), add_synced_command(), end_turn(), init_side(), and user_input().
void replay::add_config | ( | const config & | cfg, |
MARK_SENT | mark = MARK_AS_UNSENT |
||
) |
Definition at line 661 of file replay.cpp.
References base_, config::child_range(), config::has_child(), replay_recorder_base::insert_command(), mark, MARK_AS_SENT, and replay_recorder_base::size().
Referenced by playmp_controller::process_network_turn_impl().
void replay::add_countdown_update | ( | int | value, |
int | team | ||
) |
Definition at line 240 of file replay.cpp.
References config::add_child(), and add_command().
Referenced by playmp_controller::after_human_turn().
void replay::add_label | ( | const terrain_label * | label | ) |
Definition at line 273 of file replay.cpp.
References config::add_child(), add_nonundoable_command(), and label.
Referenced by events::menu_handler::label_terrain().
void replay::add_log_data | ( | const std::string & | category, |
const std::string & | key, | ||
const config & | c | ||
) |
Definition at line 327 of file replay.cpp.
References config::add_child(), base_, c, config::child_or_add(), and replay_recorder_base::get_upload_log().
void replay::add_log_data | ( | const std::string & | category, |
const std::string & | key, | ||
const std::string & | var | ||
) |
Definition at line 320 of file replay.cpp.
References base_, config::child_or_add(), and replay_recorder_base::get_upload_log().
void replay::add_log_data | ( | const std::string & | key, |
const std::string & | var | ||
) |
Definition at line 314 of file replay.cpp.
References base_, and replay_recorder_base::get_upload_log().
Referenced by game_lua_kernel::intf_log_replay(), ai_testing::log_draw(), ai_testing::log_game_end(), ai_testing::log_game_start(), ai_testing::log_turn(), ai_testing::log_victory(), and mp::start_local_game_commandline().
|
private |
adds a new command to the command list at the current position.
Definition at line 597 of file replay.cpp.
References at_end(), base_, replay_recorder_base::get_pos(), replay_recorder_base::insert_command(), replay_recorder_base::set_pos(), and replay_recorder_base::size().
Referenced by add_label(), add_surrender(), clear_labels(), and speak().
void replay::add_rename | ( | const std::string & | name, |
const map_location & | loc | ||
) |
Definition at line 294 of file replay.cpp.
References config::add_child(), add_command(), and map_location::write().
Referenced by events::menu_handler::rename_unit().
void replay::add_start | ( | ) |
Definition at line 227 of file replay.cpp.
References config::add_child(), and add_command().
bool replay::add_start_if_not_there_yet | ( | ) |
Definition at line 675 of file replay.cpp.
References _(), at_end(), base_, replay_recorder_base::get_command_at(), replay_recorder_base::get_pos(), config::has_child(), replay_recorder_base::insert_command(), and VALIDATE.
Referenced by play_controller::start_game().
void replay::add_surrender | ( | int | side_number | ) |
Definition at line 234 of file replay.cpp.
References config::add_child(), and add_nonundoable_command().
Referenced by playmp_controller::surrender().
void replay::add_synced_command | ( | const std::string & | name, |
const config & | command | ||
) |
Definition at line 248 of file replay.cpp.
References config::add_child(), add_command(), command(), resources::controller, play_controller::current_side(), config::debug(), and LOG_REPLAY.
Referenced by actions::move_unit_and_record(), synced_context::run_and_store(), and actions::teleport_unit_and_record().
void replay::add_unit_checksum | ( | const map_location & | loc, |
config & | cfg | ||
) |
Definition at line 206 of file replay.cpp.
References config::add_child(), unit_map::find(), resources::gameboard, get_checksum(), game_config::mp_debug, game_board::units(), unit_map::iterator_base< iter_types >::valid(), and map_location::write().
bool replay::at_end | ( | ) | const |
Definition at line 645 of file replay.cpp.
References base_, replay_recorder_base::get_pos(), and ncommands().
Referenced by add_command(), add_nonundoable_command(), add_start_if_not_there_yet(), synced_context::ask_server_choice(), playsingle_controller::hotkey_handler::can_execute_command(), get_next_action(), peek_next_action(), replay_controller::recorder_at_end(), and undo_cut().
const std::vector< chat_msg > & replay::build_chat_log | ( | ) | const |
Definition at line 380 of file replay.cpp.
References add_chat_log_entry(), command(), config::mandatory_child(), message_locations, message_log, and speak().
void replay::clear_labels | ( | const std::string & | team_name, |
bool | force | ||
) |
Definition at line 284 of file replay.cpp.
References config::add_child(), and add_nonundoable_command().
Referenced by events::menu_handler::clear_labels().
|
private |
Definition at line 576 of file replay.cpp.
References base_, replay_recorder_base::get_command_at(), and n.
Referenced by add_synced_command(), build_chat_log(), get_last_real_command(), get_next_action(), get_unsent_commands(), peek_next_action(), and undo_cut().
void replay::delete_upcoming_commands | ( | ) |
Definition at line 188 of file replay.cpp.
References base_, and replay_recorder_base::delete_upcoming_commands().
Referenced by playsingle_controller::hotkey_handler::replay_exit().
bool replay::empty | ( | ) | const |
Definition at line 656 of file replay.cpp.
References ncommands().
Referenced by savegame::convert_old_saves_1_11_0().
void replay::end_turn | ( | int | next_player_number | ) |
Definition at line 305 of file replay.cpp.
References config::add_child(), and add_command().
Referenced by playsingle_controller::sync_end_turn().
config & replay::get_last_real_command | ( | ) |
Definition at line 438 of file replay.cpp.
References base_, c, command(), ERR_REPLAY, and replay_recorder_base::get_pos().
config * replay::get_next_action | ( | ) |
Definition at line 621 of file replay.cpp.
References at_end(), base_, command(), replay_recorder_base::get_pos(), LOG_REPLAY, ncommands(), and replay_recorder_base::set_pos().
Referenced by synced_context::ask_server_choice(), do_replay_handle(), user_choice_manager::search_in_replay(), and play_controller::start_game().
Definition at line 397 of file replay.cpp.
References config::add_child(), ALL_DATA, c, command(), ncommands(), and sent_upto_.
Referenced by playmp_controller::send_actions().
void replay::init_side | ( | ) |
Definition at line 219 of file replay.cpp.
References config::add_child(), add_command(), resources::controller, and play_controller::current_side().
Referenced by play_controller::maybe_do_init_side().
int replay::ncommands | ( | ) | const |
Definition at line 582 of file replay.cpp.
References base_, and replay_recorder_base::size().
Referenced by at_end(), empty(), get_next_action(), get_unsent_commands(), peek_next_action(), redo(), and undo_cut().
config * replay::peek_next_action | ( | ) |
Definition at line 633 of file replay.cpp.
References at_end(), base_, command(), replay_recorder_base::get_pos(), LOG_REPLAY, and ncommands().
|
static |
Definition at line 199 of file replay.cpp.
References resources::controller, ERR_REPLAY, wfl::msg(), and play_controller::process_oos().
Referenced by synced_context::ask_server_choice(), set_scontext_synced::do_final_checkup(), do_replay_handle(), mp_sync::get_user_choice_multiple_sides(), actions::move_unit_from_replay(), actions::move_unit_internal(), user_choice_manager::search_in_replay(), show_oos_error_error_function(), and verify().
void replay::redo | ( | const config & | dst, |
bool | set_to_end = false |
||
) |
Definition at line 417 of file replay.cpp.
References replay_recorder_base::add_child(), base_, config::child_range(), replay_recorder_base::get_pos(), ncommands(), replay_recorder_base::set_pos(), set_to_end(), and replay_recorder_base::set_to_end().
Referenced by actions::undo_list::redo(), and actions::undo_list::undo().
|
private |
Definition at line 366 of file replay.cpp.
References base_, utf8::index(), message_locations, and replay_recorder_base::remove_command().
Referenced by undo_cut().
void replay::revert_action | ( | ) |
Definition at line 614 of file replay.cpp.
References base_, replay_recorder_base::get_pos(), and replay_recorder_base::set_pos().
Referenced by synced_context::ask_server_choice(), do_replay_handle(), and user_choice_manager::search_in_replay().
void replay::set_to_end | ( | ) |
Definition at line 651 of file replay.cpp.
References base_, and replay_recorder_base::set_to_end().
Referenced by add_command(), redo(), and undo_cut().
void replay::speak | ( | const config & | cfg | ) |
Definition at line 351 of file replay.cpp.
References add_chat_message_location(), config::add_child(), add_nonundoable_command(), base_, and replay_recorder_base::size().
Referenced by build_chat_log(), and events::menu_handler::send_chat_message().
void replay::start_replay | ( | ) |
Definition at line 609 of file replay.cpp.
References base_, and replay_recorder_base::set_pos().
void replay::undo | ( | ) |
Definition at line 570 of file replay.cpp.
References dummy, and undo_cut().
Referenced by synced_context::run_and_store().
void replay::undo_cut | ( | config & | dst | ) |
Definition at line 502 of file replay.cpp.
References at_end(), c, command(), dst, rect::empty(), ERR_REPLAY, fix_rename_command(), i, ncommands(), remove_command(), and set_to_end().
Referenced by actions::undo_list::undo(), and undo().
void replay::user_input | ( | const std::string & | name, |
const config & | input, | ||
int | from_side | ||
) |
adds a user_input to the replay
name | The tag name of the config to add |
input | the contents of the config to add |
from_side | the side that had to make the decision, -1 for 'server' |
Definition at line 258 of file replay.cpp.
References config::add_child(), and add_command().
Referenced by user_choice_manager::ask_local_choice(), and synced_context::ask_server_choice().
|
private |
Definition at line 161 of file replay.hpp.
Referenced by add_chat_message_location(), add_command(), add_config(), add_log_data(), add_nonundoable_command(), add_start_if_not_there_yet(), at_end(), command(), delete_upcoming_commands(), get_last_real_command(), get_next_action(), ncommands(), peek_next_action(), redo(), remove_command(), revert_action(), set_to_end(), speak(), and start_replay().
|
private |
Definition at line 163 of file replay.hpp.
Referenced by add_chat_message_location(), build_chat_log(), and remove_command().
|
private |
Definition at line 162 of file replay.hpp.
Referenced by get_unsent_commands().