The Battle for Wesnoth  1.13.4+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 115 of file statistics.hpp.

Function Documentation

void statistics::advance_unit ( const unit u)

Definition at line 516 of file statistics.cpp.

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

Referenced by advance_unit().

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

Definition at line 532 of file statistics.cpp.

References DBG_NG, i, and merge_stats().

void statistics::clear_current_scenario ( )

Definition at line 623 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 559 of file statistics.cpp.

void statistics::read_stats ( const config cfg)

Definition at line 607 of file statistics.cpp.

References config::child_range(), and fresh_stats().

Referenced by saved_game::set_data(), and mp::wait::start_game().

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)

Definition at line 641 of file statistics.cpp.

References unit_type::cost(), ERR_NG, unit_type_data::find(), i, and unit_types.

Referenced by statistics_dialog::display_stats().

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

Definition at line 631 of file statistics.cpp.

References i.

Referenced by statistics_dialog::display_stats().

void statistics::un_recall_unit ( const unit u)
int statistics::un_recall_unit_cost ( const unit u)
void statistics::un_recruit_unit ( const unit u)
config statistics::write_stats ( )

Definition at line 584 of file statistics.cpp.

References config::add_child(), and i.

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

void statistics::write_stats ( config_writer out)