#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 (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 () |
config * | get_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_list & | commands () const |
void | remove_command (int) |
config * | add_command (bool update_random_context=true) |
Adds a new empty command to the command list. | |
Private Attributes | |
config | cfg_ |
unsigned int | pos_ |
config * | current_ |
game_state | saveInfo_ |
bool | skip_ |
std::vector< int > | message_locations |
Classes | |
struct | error |
Definition at line 37 of file replay.hpp.
enum replay::DATA_TYPE |
enum replay::MARK_SENT |
replay::replay | ( | ) |
Definition at line 153 of file replay.cpp.
replay::replay | ( | const config & | cfg | ) | [explicit] |
Definition at line 156 of file replay.cpp.
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 | ) |
Definition at line 180 of file replay.cpp.
References skip_.
Referenced by play_controller::init(), mp::level_to_gamestate(), mp::lobby::process_event(), turn_info::process_network_data(), and replay_controller::replay_skip_animation().
bool replay::is_skipping | ( | ) | const |
Definition at line 185 of file replay.cpp.
References skip_.
Referenced by calculate_healing(), do_replay(), do_replay_handle(), play_controller::finish_turn(), replay_controller::init(), playsingle_controller::init_gui(), play_controller::init_side(), playsingle_controller::play_scenario(), and replay_controller::replay_skip_animation().
void replay::save_game | ( | const std::string & | label, | |
const config & | snapshot, | |||
const config & | starting_pos, | |||
bool | include_replay = true | |||
) |
Definition at line 190 of file replay.cpp.
References cfg_, preferences::compress_saves(), lg::config, finish_save_game(), game_state::label, log_scope, open_save_game(), PACKAGE, game_state::replay_data, saveInfo_, game_state::snapshot, game_state::starting_pos, and write_game().
Referenced by events::menu_handler::autosave(), play_game(), and events::menu_handler::save_game().
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 | |||
) |
Definition at line 238 of file replay.cpp.
References config::add_child(), add_command(), buf, and gamemap::location::write().
Referenced by ai_interface::recruit(), and events::menu_handler::redo().
void replay::add_recall | ( | int | unit_index, | |
const gamemap::location & | loc | |||
) |
Definition at line 253 of file replay.cpp.
References config::add_child(), add_command(), buf, and gamemap::location::write().
Referenced by events::menu_handler::recall(), and events::menu_handler::redo().
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 | |||
) |
Definition at line 281 of file replay.cpp.
References config::add_child(), and add_command().
Referenced by playmp_controller::after_human_turn(), and playmp_controller::play_human_turn().
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 | |||
) |
Definition at line 298 of file replay.cpp.
References add_pos(), add_unit_checksum(), buf, config::child(), current_, and config::values.
Referenced by ai_interface::attack_enemy(), and events::mouse_handler::attack_enemy_().
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 | ) |
void replay::set_random_value | ( | const std::string & | choice | ) |
void replay::add_label | ( | const terrain_label * | label | ) |
Definition at line 360 of file replay.cpp.
References config::add_child(), add_command(), and terrain_label::write().
Referenced by events::menu_handler::label_terrain().
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 | |||
) |
Definition at line 384 of file replay.cpp.
References config::add_child(), add_command(), and gamemap::location::write().
Referenced by events::menu_handler::rename_unit().
void replay::end_turn | ( | ) |
Definition at line 394 of file replay.cpp.
References config::add_child(), and add_command().
Referenced by playsingle_controller::end_turn_record(), playsingle_controller::play_ai_turn(), playmp_controller::play_human_turn(), and playsingle_controller::play_turn().
void replay::add_event | ( | const std::string & | name, | |
const gamemap::location & | loc = gamemap::location::null_location | |||
) |
Definition at line 400 of file replay.cpp.
References config::add_child(), add_command(), gamemap::location::valid(), and gamemap::location::write().
Referenced by play_controller::execute_command().
void replay::add_unit_checksum | ( | const gamemap::location & | loc, | |
config *const | cfg | |||
) |
Definition at line 219 of file replay.cpp.
References config::add_child(), unit_map::end(), unit_map::find(), get_checksum(), game_config::mp_debug, unit_map_ref, and gamemap::location::write().
Referenced by add_attack(), and add_checksum_check().
void replay::add_checksum_check | ( | const gamemap::location & | loc | ) |
Definition at line 412 of file replay.cpp.
References add_command(), add_unit_checksum(), and game_config::mp_debug.
Referenced by events::menu_handler::recall(), ai_interface::recruit(), and events::menu_handler::redo().
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 | ) |
Definition at line 436 of file replay.cpp.
References add_chat_message_location(), config::add_child(), and add_command().
Referenced by build_chat_log(), and events::menu_handler::send_chat_message().
std::string replay::build_chat_log | ( | const std::string & | team | ) |
Definition at line 479 of file replay.cpp.
References add_chat_log_entry(), commands(), message_locations, message_log, and speak().
Referenced by events::menu_handler::show_chat_log().
Definition at line 506 of file replay.cpp.
References config::add_child(), ALL_DATA, commands(), and NON_UNDO_DATA.
Referenced by replay_network_sender::commit_and_sync(), and replay_network_sender::sync_non_undoable().
config replay::get_last_turn | ( | int | num_turns = 1 |
) |
void replay::undo | ( | ) |
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 | ( | ) |
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 |
Definition at line 656 of file replay.cpp.
References commands(), and pos_.
Referenced by play_game(), replay_controller::play_replay(), playsingle_controller::play_scenario(), replay_controller::play_side(), replay_controller::play_turn(), and pre_replay().
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 | ) |
Definition at line 668 of file replay.cpp.
References cfg_, lg::config, current_, message_locations, message_log, pos_, rng::set_random(), and skip_.
Referenced by enter_connect_mode(), enter_wait_mode(), play_game(), and play_replay().
bool replay::empty | ( | ) |
Definition at line 679 of file replay.cpp.
References commands().
Referenced by play_controller::init(), and mp::level_to_gamestate().
Definition at line 684 of file replay.cpp.
References add_chat_message_location(), config::add_child(), cfg_, config::child(), config::child_range(), MARK_AS_SENT, ncommands(), and pos_.
Referenced by turn_info::process_network_data().
int replay::ncommands | ( | ) |
Definition at line 603 of file replay.cpp.
References commands().
Referenced by add_command(), add_config(), replay_network_sender::commit_and_sync(), and replay_network_sender::sync_non_undoable().
void replay::throw_error | ( | const std::string & | msg | ) | [static] |
Definition at line 159 of file replay.cpp.
References ERR_REPLAY, game_config::ignore_replay_errors, and last_replay_error.
Referenced by attack::attack(), do_replay_handle(), and verify().
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] |
const config::child_list & replay::commands | ( | ) | const [private] |
Definition at line 598 of file replay.cpp.
References cfg_, and config::get_children().
Referenced by at_end(), build_chat_log(), empty(), get_data_range(), get_next_action(), ncommands(), pre_replay(), and set_to_end().
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.
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. |
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().
std::string replay::last_replay_error [static] |
Definition at line 117 of file replay.hpp.
Referenced by playmp_controller::handle_generic_event(), turn_info::process_network_data(), and throw_error().
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 142 of file replay.hpp.
Referenced by add_chat_message_location(), add_command(), add_config(), at_end(), clear(), get_next_action(), pre_replay(), revert_action(), set_to_end(), and start_replay().
config* replay::current_ [private] |
Definition at line 144 of file replay.hpp.
Referenced by add_attack(), add_command(), clear(), get_next_action(), set_to_end(), and undo().
game_state replay::saveInfo_ [private] |
Definition at line 146 of file replay.hpp.
Referenced by save_game(), set_save_info(), and set_save_info_completion().
bool replay::skip_ [private] |
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().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |