The Battle for Wesnoth  1.15.1+dev
Macros | Functions | Variables
replay.cpp File Reference

Replay control code. More...

#include "replay.hpp"
#include "actions/undo.hpp"
#include "display_chat_manager.hpp"
#include "floating_label.hpp"
#include "game_display.hpp"
#include "preferences/game.hpp"
#include "game_data.hpp"
#include "lexical_cast.hpp"
#include "log.hpp"
#include "map/label.hpp"
#include "map/location.hpp"
#include "play_controller.hpp"
#include "synced_context.hpp"
#include "resources.hpp"
#include "statistics.hpp"
#include "units/unit.hpp"
#include "whiteboard/manager.hpp"
#include "replay_recorder_base.hpp"
#include <set>
#include <map>
Include dependency graph for replay.cpp:

Go to the source code of this file.

Macros

#define DBG_REPLAY   LOG_STREAM(debug, log_replay)
 
#define LOG_REPLAY   LOG_STREAM(info, log_replay)
 
#define WRN_REPLAY   LOG_STREAM(warn, log_replay)
 
#define ERR_REPLAY   LOG_STREAM(err, log_replay)
 
#define DBG_RND   LOG_STREAM(debug, log_random)
 
#define LOG_RND   LOG_STREAM(info, log_random)
 
#define WRN_RND   LOG_STREAM(warn, log_random)
 
#define ERR_RND   LOG_STREAM(err, log_random)
 

Functions

static void verify (const unit_map &units, const config &cfg)
 
static std::time_t get_time (const config &speak)
 
static bool fix_rename_command (const config &c, config &async_child)
 fixes a rename command when undoing a earlier command. More...
 
static void show_oos_error_error_function (const std::string &message, bool)
 
REPLAY_RETURN do_replay (bool one_move)
 
REPLAY_RETURN do_replay_handle (bool one_move)
 

Variables

static lg::log_domain log_replay ("replay")
 
static lg::log_domain log_random ("random")
 
static std::vector< chat_msgmessage_log
 

Detailed Description

Replay control code.

See https://www.wesnoth.org/wiki/ReplayWML for more info.

Definition in file replay.cpp.

Macro Definition Documentation

◆ DBG_REPLAY

#define DBG_REPLAY   LOG_STREAM(debug, log_replay)

Definition at line 46 of file replay.cpp.

Referenced by do_replay_handle().

◆ DBG_RND

#define DBG_RND   LOG_STREAM(debug, log_random)

Definition at line 52 of file replay.cpp.

◆ ERR_REPLAY

#define ERR_REPLAY   LOG_STREAM(err, log_replay)

◆ ERR_RND

#define ERR_RND   LOG_STREAM(err, log_random)

Definition at line 55 of file replay.cpp.

◆ LOG_REPLAY

#define LOG_REPLAY   LOG_STREAM(info, log_replay)

◆ LOG_RND

#define LOG_RND   LOG_STREAM(info, log_random)

Definition at line 53 of file replay.cpp.

◆ WRN_REPLAY

#define WRN_REPLAY   LOG_STREAM(warn, log_replay)

Definition at line 48 of file replay.cpp.

Referenced by do_replay_handle(), and fix_rename_command().

◆ WRN_RND

#define WRN_RND   LOG_STREAM(warn, log_random)

Definition at line 54 of file replay.cpp.

Function Documentation

◆ do_replay()

REPLAY_RETURN do_replay ( bool  one_move)

◆ do_replay_handle()

REPLAY_RETURN do_replay_handle ( bool  one_move)
Returns
: if we expect a user choice and found something that prevents us from moving on we return REPLAY_FOUND_DEPENDENT (even if it is not a dependent command) else if we found an [end_turn] we return REPLAY_FOUND_END_TURN else if we found a player action and one_move=true we return REPLAY_FOUND_END_MOVE else (<=> we reached the end of the replay) we return REPLAY_RETURN_AT_END

Definition at line 695 of file replay.cpp.

References display_chat_manager::add_chat_message(), replay::add_chat_message_location(), config::all_children_count(), config::all_children_range(), config::child(), map_labels::clear(), replay::clear_labels(), terrain_label::color(), resources::controller, terrain_label::creator(), play_controller::current_side(), DBG_REPLAY, config::debug(), play_controller::do_init_side(), replay::end_turn(), ERR_REPLAY, unit_map::find(), resources::gameboard, play_controller::gamestate(), game_display::get_chat_manager(), replay::get_next_action(), game_display::get_singleton(), display::get_singleton(), synced_context::get_synced_state(), game_board::get_team(), get_time(), config::has_child(), synced_context::is_synced(), display::labels(), terrain_label::location(), LOG_REPLAY, preferences::message_bell(), events::chat_handler::MESSAGE_PRIVATE, events::chat_handler::MESSAGE_PUBLIC, name(), game_state::next_player_number_, config::ordered_begin(), replay::process_error(), resources::recorder, REPLAY_FOUND_DEPENDENT, REPLAY_FOUND_END_LEVEL, REPLAY_FOUND_END_MOVE, REPLAY_FOUND_END_TURN, REPLAY_FOUND_INIT_TURN, REPLAY_RETURN_AT_END, replay::revert_action(), synced_context::run(), team::set_countdown_time(), map_labels::set_label(), show_oos_error_error_function(), utf8::size(), replay::speak(), terrain_label::team_name(), terrain_label::text(), game_board::units(), synced_context::UNSYNCED, unit_map::iterator_base< iter_types >::valid(), verify(), and WRN_REPLAY.

Referenced by synced_context::ask_server_choice(), do_replay(), user_choice_manager::pull(), user_choice_manager::search_in_replay(), and user_choice_manager::user_choice_manager().

◆ fix_rename_command()

static bool fix_rename_command ( const config c,
config async_child 
)
static

fixes a rename command when undoing a earlier command.

Returns
: true if the command should be removed.

Definition at line 452 of file replay.cpp.

References config::child(), ERR_REPLAY, read_locations(), map_location::write(), and WRN_REPLAY.

Referenced by replay::undo_cut().

◆ get_time()

static std::time_t get_time ( const config speak)
static

Definition at line 127 of file replay.cpp.

Referenced by chat_msg::chat_msg(), and do_replay_handle().

◆ show_oos_error_error_function()

static void show_oos_error_error_function ( const std::string &  message,
bool   
)
static

Definition at line 672 of file replay.cpp.

References replay::process_error().

Referenced by do_replay_handle().

◆ verify()

static void verify ( const unit_map units,
const config cfg 
)
static

Variable Documentation

◆ log_random

lg::log_domain log_random("random")
static

◆ log_replay

lg::log_domain log_replay("replay")
static

◆ message_log

std::vector< chat_msg > message_log
static

Definition at line 373 of file replay.cpp.

Referenced by replay::build_chat_log().