The Battle for Wesnoth  1.17.4+dev
Classes | Typedefs | Functions
statistics Namespace Reference


struct  attack_context
struct  scenario_context
struct  stats


typedef std::vector< std::pair< const std::string *, const stats * > > levels
 Stats (and name) for each scenario. More...


void recruit_unit (const unit &u)
void recall_unit (const unit &u)
void un_recall_unit (const unit &u)
void un_recruit_unit (const unit &u)
int un_recall_unit_cost (const unit &u)
void advance_unit (const unit &u)
void reset_turn_stats (const std::string &save_id)
stats calculate_stats (const std::string &save_id)
levels level_stats (const std::string &save_id)
 Returns a list of names and stats for each scenario in the current campaign. More...
config write_stats ()
void write_stats (config_writer &out)
void read_stats (const config &cfg)
void fresh_stats ()
void clear_current_scenario ()
 Delete the current scenario from the stats. More...
void reset_current_scenario ()
 Reset the stats of the current scenario to the beginning. More...
int sum_str_int_map (const stats::str_int_map &m)
int sum_cost_str_int_map (const stats::str_int_map &m)

Typedef Documentation

◆ levels

typedef std::vector< std::pair<const std::string *, const stats *> > statistics::levels

Stats (and name) for each scenario.

The pointers are never nullptr.

Definition at line 136 of file statistics.hpp.

Function Documentation

◆ advance_unit()

void statistics::advance_unit ( const unit u)

Definition at line 681 of file statistics.cpp.

References statistics::stats::advanced_to, get_stats(), s, and unit::type_id().

Referenced by advance_unit().

◆ calculate_stats()

stats statistics::calculate_stats ( const std::string &  save_id)

Definition at line 699 of file statistics.cpp.

References DBG_NG, i, and merge_stats().

◆ clear_current_scenario()

void statistics::clear_current_scenario ( )

Delete the current scenario from the stats.

Definition at line 789 of file statistics.cpp.

Referenced by game_launcher::load_game().

◆ fresh_stats()

void statistics::fresh_stats ( )

◆ level_stats()

levels statistics::level_stats ( const std::string &  save_id)

Returns a list of names and stats for each scenario in the current campaign.

The front of the list is the oldest scenario; the back of the list is the (most) current scenario. Only scenarios with stats for the given side_id are included, but if no scenarios are applicable, then a vector containing a single dummy entry will be returned. (I.e., this never returns an empty vector.) This list is intended for the statistics dialog and may become invalid if new stats are recorded.

Definition at line 726 of file statistics.cpp.

References game_config::images::level.

◆ read_stats()

void statistics::read_stats ( const config cfg)

◆ recall_unit()

void statistics::recall_unit ( const unit u)

◆ recruit_unit()

void statistics::recruit_unit ( const unit u)

◆ reset_current_scenario()

void statistics::reset_current_scenario ( )

Reset the stats of the current scenario to the beginning.

Definition at line 797 of file statistics.cpp.

Referenced by playsingle_controller::play_scenario_main_loop().

◆ reset_turn_stats()

void statistics::reset_turn_stats ( const std::string &  save_id)

◆ sum_cost_str_int_map()

int statistics::sum_cost_str_int_map ( const stats::str_int_map m)

◆ sum_str_int_map()

int statistics::sum_str_int_map ( const stats::str_int_map m)

Definition at line 804 of file statistics.cpp.

References i.

Referenced by gui2::dialogs::statistics_dialog::add_stat_row().

◆ un_recall_unit()

void statistics::un_recall_unit ( const unit u)

◆ un_recall_unit_cost()

int statistics::un_recall_unit_cost ( const unit u)

Definition at line 675 of file statistics.cpp.

References unit::recall_cost().

Referenced by wb::recall::draw_hex(), and actions::undo::recall_action::undo().

◆ un_recruit_unit()

void statistics::un_recruit_unit ( const unit u)

◆ write_stats() [1/2]

config statistics::write_stats ( )

Definition at line 750 of file statistics.cpp.

References config::add_child(), and i.

Referenced by savegame::savegame::write_game().

◆ write_stats() [2/2]

void statistics::write_stats ( config_writer out)