The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
replay Class Reference

#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_countdown_update (int value, int team)
 
void add_synced_command (const std::string &name, const config &command)
 
void init_side ()
 
configget_last_real_command ()
 
void user_input (const std::string &, const config &, 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 ()
 
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 ()
 
config get_data_range (int cmd_start, int cmd_end, DATA_TYPE data_type=ALL_DATA)
 
void undo ()
 
void undo_cut (config &dst)
 
void redo (const config &dst)
 
void start_replay ()
 
void revert_action ()
 
configget_next_action ()
 
bool at_end () const
 
void set_to_end ()
 
bool empty ()
 
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
 
configcommand (int)
 
void remove_command (int)
 
configadd_command ()
 Adds a new empty command to the command list at the end. More...
 
configadd_nonundoable_command ()
 adds a new command to the command list at the current position. More...
 

Private Attributes

replay_recorder_basebase_
 
std::vector< intmessage_locations
 

Detailed Description

Definition at line 52 of file replay.hpp.

Member Enumeration Documentation

Enumerator
ALL_DATA 
NON_UNDO_DATA 

Definition at line 98 of file replay.hpp.

Enumerator
MARK_AS_UNSENT 
MARK_AS_SENT 

Definition at line 122 of file replay.hpp.

Constructor & Destructor Documentation

replay::replay ( replay_recorder_base base)
explicit

Definition at line 182 of file replay.cpp.

Member Function Documentation

void replay::add_chat_log_entry ( const config speak,
std::back_insert_iterator< std::vector< chat_msg > > &  i 
) const
private

Definition at line 350 of file replay.cpp.

References i, preferences::is_ignored(), and preferences::parse_should_show_lobby_join().

Referenced by build_chat_log().

bool replay::add_chat_message_location ( )

adds a chat message if it wasn't added yet.

Returns
true if a message location was added

Definition at line 325 of file replay.cpp.

References base_, and replay_recorder_base::get_pos().

Referenced by speak().

bool replay::add_chat_message_location ( int  pos)
config & replay::add_command ( )
private

Adds a new empty command to the command list at the end.

Returns
a reference to the added command

Definition at line 568 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 
)
void replay::add_countdown_update ( int  value,
int  team 
)

Definition at line 233 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)
void replay::add_log_data ( const std::string key,
const std::string var 
)
void replay::add_log_data ( const std::string category,
const std::string key,
const std::string var 
)

Definition at line 311 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 category,
const std::string key,
const config c 
)
config & replay::add_nonundoable_command ( )
private

adds a new command to the command list at the current position.

Returns
a reference to the added command

Definition at line 578 of file replay.cpp.

References base_, replay_recorder_base::get_pos(), replay_recorder_base::insert_command(), and replay_recorder_base::set_pos().

Referenced by add_label(), and clear_labels().

void replay::add_rename ( const std::string name,
const map_location loc 
)

Definition at line 287 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 226 of file replay.cpp.

References config::add_child(), and add_command().

bool replay::add_start_if_not_there_yet ( )
void replay::add_synced_command ( const std::string name,
const config command 
)
void replay::add_unit_checksum ( const map_location loc,
config cfg 
)
bool replay::at_end ( ) const
const std::vector< chat_msg > & replay::build_chat_log ( )
void replay::clear_labels ( const std::string team_name,
bool  force 
)

Definition at line 277 of file replay.cpp.

References config::add_child(), and add_nonundoable_command().

Referenced by events::menu_handler::clear_labels().

config & replay::command ( int  n)
private
void replay::delete_upcoming_commands ( )
bool replay::empty ( )

Definition at line 622 of file replay.cpp.

References ncommands().

void replay::end_turn ( )

Definition at line 298 of file replay.cpp.

References config::add_child(), and add_command().

Referenced by playsingle_controller::sync_end_turn().

config replay::get_data_range ( int  cmd_start,
int  cmd_end,
DATA_TYPE  data_type = ALL_DATA 
)
config & replay::get_last_real_command ( )

Definition at line 423 of file replay.cpp.

References base_, c, command(), ERR_REPLAY, and replay_recorder_base::get_pos().

config * replay::get_next_action ( )
void replay::init_side ( )
int replay::ncommands ( ) const
void replay::process_error ( const std::string msg)
static
void replay::redo ( const config dst)
void replay::remove_command ( int  index)
private

Definition at line 359 of file replay.cpp.

References base_, message_locations, and replay_recorder_base::remove_command().

Referenced by undo_cut().

void replay::revert_action ( )
void replay::set_to_end ( )

Definition at line 617 of file replay.cpp.

References base_, and replay_recorder_base::set_to_end().

Referenced by add_command(), and undo_cut().

void replay::speak ( const config cfg)
void replay::start_replay ( )

Definition at line 586 of file replay.cpp.

References base_, and replay_recorder_base::set_pos().

void replay::undo ( )

Definition at line 550 of file replay.cpp.

References undo_cut().

Referenced by synced_context::run_and_store().

void replay::undo_cut ( config dst)
void replay::user_input ( const std::string name,
const config input,
int  from_side 
)

adds a user_input to the replay

Parameters
from_sidethe side that had to make the decision, -1 for 'server'

Definition at line 251 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().

Member Data Documentation

replay_recorder_base* replay::base_
private
std::vector<int> replay::message_locations
private

Definition at line 152 of file replay.hpp.

Referenced by add_chat_message_location(), build_chat_log(), and remove_command().


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