#include <statistics.hpp>
Public Types | |
using | stats = statistics_record::stats_t |
typedef std::vector< std::pair< const std::string *, const stats * > > | levels |
Stats (and name) for each scenario. More... | |
Public Member Functions | |
statistics_t (statistics_record::campaign_stats_t &record) | |
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) |
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... | |
stats & | get_stats (const std::string &save_id) |
returns the stats for the given side in the current scenario. More... | |
Static Public Member Functions | |
static int | sum_str_int_map (const std::map< std::string, int > &m) |
static int | sum_cost_str_int_map (const std::map< std::string, int > &m) |
Private Member Functions | |
auto & | master_stats () |
Private Attributes | |
statistics_record::campaign_stats_t & | record_ |
Definition at line 25 of file statistics.hpp.
typedef std::vector< std::pair<const std::string *, const stats *> > statistics_t::levels |
Stats (and name) for each scenario.
The pointers are never nullptr.
Definition at line 42 of file statistics.hpp.
Definition at line 28 of file statistics.hpp.
statistics_t::statistics_t | ( | statistics_record::campaign_stats_t & | record | ) |
Definition at line 46 of file statistics.cpp.
void statistics_t::advance_unit | ( | const unit & | u | ) |
Definition at line 201 of file statistics.cpp.
References get_stats(), s, and unit::type_id().
Referenced by advance_unit().
statistics_t::stats statistics_t::calculate_stats | ( | const std::string & | save_id | ) |
Definition at line 219 of file statistics.cpp.
References DBG_NG, i, master_stats(), and statistics_record::stats_t::merge_with().
statistics_t::stats & statistics_t::get_stats | ( | const std::string & | save_id | ) |
returns the stats for the given side in the current scenario.
Definition at line 271 of file statistics.cpp.
References master_stats().
Referenced by advance_unit(), statistics_attack_context::attacker_stats(), statistics_attack_context::defender_stats(), recall_unit(), recruit_unit(), reset_turn_stats(), un_recall_unit(), and un_recruit_unit().
statistics_t::levels statistics_t::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 246 of file statistics.cpp.
References game_config::images::level, and master_stats().
|
inlineprivate |
Definition at line 53 of file statistics.hpp.
References statistics_record::campaign_stats_t::master_record, and record_.
Referenced by calculate_stats(), get_stats(), and level_stats().
void statistics_t::recall_unit | ( | const unit & | u | ) |
Definition at line 180 of file statistics.cpp.
References unit::cost(), get_stats(), s, and unit::type_id().
Referenced by actions::recall_unit().
void statistics_t::recruit_unit | ( | const unit & | u | ) |
Definition at line 173 of file statistics.cpp.
References unit::cost(), get_stats(), unit_type::parent_id(), s, and unit::type().
Referenced by actions::recruit_unit().
void statistics_t::reset_turn_stats | ( | const std::string & | save_id | ) |
Definition at line 207 of file statistics.cpp.
References get_stats(), and s.
Referenced by play_controller::do_init_side().
|
static |
Definition at line 290 of file statistics.cpp.
References ERR_NG, unit_type_data::find(), t, and unit_types.
Referenced by gui2::dialogs::statistics_dialog::add_stat_row().
|
static |
Definition at line 280 of file statistics.cpp.
Referenced by gui2::dialogs::statistics_dialog::add_stat_row().
void statistics_t::un_recall_unit | ( | const unit & | u | ) |
Definition at line 187 of file statistics.cpp.
References unit::cost(), get_stats(), s, and unit::type_id().
Referenced by actions::undo::recall_action::undo().
void statistics_t::un_recruit_unit | ( | const unit & | u | ) |
Definition at line 194 of file statistics.cpp.
References unit::cost(), get_stats(), unit_type::parent_id(), s, and unit::type().
Referenced by actions::undo::recruit_action::undo().
|
private |
Definition at line 51 of file statistics.hpp.
Referenced by master_stats().