replay Class Reference

#include <replay.hpp>

Inheritance diagram for replay:

Inheritance graph
[legend]
Collaboration diagram for replay:

Collaboration graph
[legend]

List of all members.

Public Types

enum  DATA_TYPE { ALL_DATA, NON_UNDO_DATA }
enum  MARK_SENT { MARK_AS_UNSENT, MARK_AS_SENT }

Public Member Functions

 replay ()
 replay (const config &cfg)
void set_save_info (const game_state &save)
void set_save_info_completion (const std::string &st)
void set_skip (bool skip)
bool is_skipping () const
void save_game (const std::string &label, const config &snapshot, const config &starting_pos, bool include_replay=true)
void add_start ()
void add_recruit (int unit_index, const gamemap::location &loc)
void add_recall (int unit_index, const gamemap::location &loc)
void add_disband (int unit_index)
void add_countdown_update (int value, int team)
void add_movement (const gamemap::location &a, const gamemap::location &b)
void add_attack (const gamemap::location &a, const gamemap::location &b, int att_weapon, int def_weapon)
void choose_option (int index)
void text_input (std::string input)
void set_random_value (const std::string &choice)
void add_label (const terrain_label *)
void clear_labels (const std::string &)
void add_rename (const std::string &name, const gamemap::location &loc)
void end_turn ()
void add_event (const std::string &name, const gamemap::location &loc=gamemap::location::null_location)
void add_unit_checksum (const gamemap::location &loc, config *const cfg)
void add_checksum_check (const gamemap::location &loc)
void add_advancement (const gamemap::location &loc)
 Adds an advancement to the replay, the following option command determines which advancement option has been choosen.
void add_chat_message_location ()
void speak (const config &cfg)
std::string build_chat_log (const std::string &team)
config get_data_range (int cmd_start, int cmd_end, DATA_TYPE data_type=ALL_DATA)
config get_last_turn (int num_turns=1)
void undo ()
void start_replay ()
void revert_action ()
configget_next_action ()
void pre_replay ()
bool at_end () const
void set_to_end ()
void clear ()
bool empty ()
void add_config (const config &cfg, MARK_SENT mark=MARK_AS_UNSENT)
int ncommands ()

Static Public Member Functions

static void throw_error (const std::string &msg)

Static Public Attributes

static std::string last_replay_error

Private Member Functions

void add_pos (const std::string &type, const gamemap::location &a, const gamemap::location &b)
void add_value (const std::string &type, int value)
void add_chat_log_entry (const config *, std::stringstream &, const std::string &) const
const config::child_listcommands () const
void remove_command (int)
configadd_command (bool update_random_context=true)
 Adds a new empty command to the command list.

Private Attributes

config cfg_
unsigned int pos_
configcurrent_
game_state saveInfo_
bool skip_
std::vector< int > message_locations

Classes

struct  error


Detailed Description

Definition at line 37 of file replay.hpp.


Member Enumeration Documentation

Enumerator:
ALL_DATA 
NON_UNDO_DATA 

Definition at line 88 of file replay.hpp.

Enumerator:
MARK_AS_UNSENT 
MARK_AS_SENT 

Definition at line 105 of file replay.hpp.


Constructor & Destructor Documentation

replay::replay (  ) 

Definition at line 153 of file replay.cpp.

replay::replay ( const config cfg  )  [explicit]

Definition at line 156 of file replay.cpp.


Member Function Documentation

void replay::set_save_info ( const game_state save  ) 

Definition at line 166 of file replay.cpp.

References saveInfo_.

Referenced by play_game(), and play_replay().

void replay::set_save_info_completion ( const std::string &  st  ) 

Definition at line 172 of file replay.cpp.

References game_state::completion, and saveInfo_.

Referenced by play_game(), and playsingle_controller::play_scenario().

void replay::set_skip ( bool  skip  ) 

bool replay::is_skipping (  )  const

void replay::save_game ( const std::string &  label,
const config snapshot,
const config starting_pos,
bool  include_replay = true 
)

void replay::add_start (  ) 

Definition at line 232 of file replay.cpp.

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

Referenced by play_controller::init().

void replay::add_recruit ( int  unit_index,
const gamemap::location loc 
)

void replay::add_recall ( int  unit_index,
const gamemap::location loc 
)

void replay::add_disband ( int  unit_index  ) 

Definition at line 268 of file replay.cpp.

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

Referenced by events::delete_recall_unit::button_pressed().

void replay::add_countdown_update ( int  value,
int  team 
)

void replay::add_movement ( const gamemap::location a,
const gamemap::location b 
)

Definition at line 293 of file replay.cpp.

References add_pos().

Referenced by move_unit(), ai_interface::move_unit_partial(), and events::menu_handler::redo().

void replay::add_attack ( const gamemap::location a,
const gamemap::location b,
int  att_weapon,
int  def_weapon 
)

void replay::choose_option ( int  index  ) 

Definition at line 337 of file replay.cpp.

References add_value().

Referenced by dialogs::advance_unit().

void replay::text_input ( std::string  input  ) 

Definition at line 342 of file replay.cpp.

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

void replay::set_random_value ( const std::string &  choice  ) 

Definition at line 352 of file replay.cpp.

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

void replay::add_label ( const terrain_label label  ) 

void replay::clear_labels ( const std::string &  team_name  ) 

Definition at line 374 of file replay.cpp.

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

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

void replay::add_rename ( const std::string &  name,
const gamemap::location loc 
)

void replay::end_turn (  ) 

void replay::add_event ( const std::string &  name,
const gamemap::location loc = gamemap::location::null_location 
)

void replay::add_unit_checksum ( const gamemap::location loc,
config *const   cfg 
)

void replay::add_checksum_check ( const gamemap::location loc  ) 

void replay::add_advancement ( const gamemap::location loc  ) 

Adds an advancement to the replay, the following option command determines which advancement option has been choosen.

Definition at line 421 of file replay.cpp.

References config::add_child(), add_command(), and gamemap::location::write().

Referenced by dialogs::advance_unit().

void replay::add_chat_message_location (  ) 

Definition at line 431 of file replay.cpp.

References message_locations, and pos_.

Referenced by add_config(), do_replay_handle(), and speak().

void replay::speak ( const config cfg  ) 

std::string replay::build_chat_log ( const std::string &  team  ) 

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

config replay::get_last_turn ( int  num_turns = 1  ) 

void replay::undo (  ) 

Todo:
Change undo= to default to "no" and explicitely mark all undoable commands with yes.

Definition at line 528 of file replay.cpp.

References cfg_, config::child(), config::child_range(), current_, game_events::get_state_of_game(), remove_command(), and rng::set_random().

Referenced by events::menu_handler::recall(), events::menu_handler::redo(), events::menu_handler::undo(), and replay_undo::~replay_undo().

void replay::start_replay (  ) 

Definition at line 618 of file replay.cpp.

References pos_.

Referenced by turn_info::process_network_data(), and replay_controller::reset_replay().

void replay::revert_action (  ) 

Definition at line 623 of file replay.cpp.

References pos_.

Referenced by do_replay_handle().

config * replay::get_next_action (  ) 

Definition at line 629 of file replay.cpp.

References commands(), current_, LOG_REPLAY, pos_, rng::set_random(), and size.

Referenced by do_replay_handle().

void replay::pre_replay (  ) 

Definition at line 642 of file replay.cpp.

References add_command(), at_end(), commands(), pos_, rng::random(), rng::set_random(), and size.

Referenced by play_controller::init().

bool replay::at_end (  )  const

void replay::set_to_end (  ) 

Definition at line 661 of file replay.cpp.

References commands(), current_, pos_, and rng::set_random().

Referenced by mp::level_to_gamestate().

void replay::clear ( void   ) 

bool replay::empty (  ) 

Definition at line 679 of file replay.cpp.

References commands().

Referenced by play_controller::init(), and mp::level_to_gamestate().

void replay::add_config ( const config cfg,
MARK_SENT  mark = MARK_AS_UNSENT 
)

int replay::ncommands (  ) 

void replay::throw_error ( const std::string &  msg  )  [static]

void replay::add_pos ( const std::string &  type,
const gamemap::location a,
const gamemap::location b 
) [private]

Definition at line 310 of file replay.cpp.

References config::add_child(), add_command(), and gamemap::location::write().

Referenced by add_attack(), and add_movement().

void replay::add_value ( const std::string &  type,
int  value 
) [private]

Definition at line 324 of file replay.cpp.

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

Referenced by choose_option().

void replay::add_chat_log_entry ( const config speak,
std::stringstream &  str,
const std::string &  team 
) const [private]

Definition at line 446 of file replay.cpp.

References cfg.

Referenced by build_chat_log().

const config::child_list & replay::commands (  )  const [private]

void replay::remove_command ( int  index  )  [private]

Definition at line 465 of file replay.cpp.

References cfg_, message_locations, and config::remove_child().

Referenced by undo().

config * replay::add_command ( bool  update_random_context = true  )  [private]

Adds a new empty command to the command list.

Parameters:
update_random_context If set to false, do not update the random context variables: all random generation will take place in the previous random context. Used for commands for which "random context" is pointless, and which can be issued while some other commands are still taking place, like, for example, messages during combats.
Returns:
a pointer to the added command

Definition at line 608 of file replay.cpp.

References config::add_child(), cfg_, current_, ncommands(), pos_, and rng::set_random().

Referenced by add_advancement(), add_checksum_check(), add_countdown_update(), add_disband(), add_event(), add_label(), add_pos(), add_recall(), add_recruit(), add_rename(), add_start(), add_value(), clear_labels(), end_turn(), pre_replay(), set_random_value(), speak(), and text_input().


Member Data Documentation

std::string replay::last_replay_error [static]

config replay::cfg_ [private]

Definition at line 141 of file replay.hpp.

Referenced by add_command(), add_config(), clear(), commands(), remove_command(), save_game(), and undo().

unsigned int replay::pos_ [private]

Definition at line 144 of file replay.hpp.

Referenced by add_attack(), add_command(), clear(), get_next_action(), set_to_end(), and undo().

Definition at line 146 of file replay.hpp.

Referenced by save_game(), set_save_info(), and set_save_info_completion().

bool replay::skip_ [private]

Definition at line 148 of file replay.hpp.

Referenced by clear(), is_skipping(), and set_skip().

std::vector<int> replay::message_locations [private]

Definition at line 150 of file replay.hpp.

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


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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs