The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Typedefs | Functions
statistics Namespace Reference

Classes

struct  attack_context
 
struct  scenario_context
 
struct  stats
 

Typedefs

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

Functions

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 ()
 
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

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 114 of file statistics.hpp.

Function Documentation

void statistics::advance_unit ( const unit u)

Definition at line 540 of file statistics.cpp.

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

Referenced by advance_unit().

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

Definition at line 556 of file statistics.cpp.

References DBG_NG, i, and merge_stats().

void statistics::clear_current_scenario ( )

Definition at line 646 of file statistics.cpp.

Referenced by game_launcher::load_game().

void statistics::fresh_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 583 of file statistics.cpp.

References game_config::images::level.

void statistics::read_stats ( const config cfg)
void statistics::recall_unit ( const unit u)
void statistics::recruit_unit ( const unit u)
void statistics::reset_turn_stats ( const std::string &  save_id)
int statistics::sum_cost_str_int_map ( const stats::str_int_map &  m)
int statistics::sum_str_int_map ( const stats::str_int_map &  m)

Definition at line 654 of file statistics.cpp.

References i.

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

void statistics::un_recall_unit ( const unit u)
int statistics::un_recall_unit_cost ( const unit u)

Definition at line 534 of file statistics.cpp.

References unit::recall_cost().

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

void statistics::un_recruit_unit ( const unit u)
config statistics::write_stats ( )

Definition at line 607 of file statistics.cpp.

References config::add_child(), and i.

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

void statistics::write_stats ( config_writer out)