Hit stats: Rename a type to reflect its content rather than its use
This commit is contained in:
parent
ff5df5141e
commit
bad65044dc
2 changed files with 9 additions and 9 deletions
|
@ -240,7 +240,7 @@ static stats::hitrate_map read_by_cth_map(const config& cfg)
|
|||
{
|
||||
stats::hitrate_map m;
|
||||
for(const config &i : cfg.child_range("keyvalue")) {
|
||||
m.emplace(i["key"], statistics::stats::by_cth_t(i.child("value")));
|
||||
m.emplace(i["key"], statistics::stats::hitrate_t(i.child("value")));
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
@ -823,17 +823,17 @@ int sum_cost_str_int_map(const stats::str_int_map &m)
|
|||
return cost;
|
||||
}
|
||||
|
||||
config stats::by_cth_t::write() const
|
||||
config stats::hitrate_t::write() const
|
||||
{
|
||||
return config("hits", hits, "strikes", strikes);
|
||||
}
|
||||
|
||||
stats::by_cth_t::by_cth_t(const config &cfg) :
|
||||
stats::hitrate_t::hitrate_t(const config &cfg) :
|
||||
strikes(cfg["strikes"]),
|
||||
hits(cfg["hits"])
|
||||
{}
|
||||
|
||||
std::ostream& operator<<(std::ostream& outstream, const statistics::stats::by_cth_t& by_cth) {
|
||||
std::ostream& operator<<(std::ostream& outstream, const statistics::stats::hitrate_t& by_cth) {
|
||||
outstream << "[" << by_cth.hits << "/" << by_cth.strikes << "]";
|
||||
return outstream;
|
||||
}
|
||||
|
|
|
@ -59,15 +59,15 @@ namespace statistics
|
|||
long long damage_inflicted, damage_taken;
|
||||
long long turn_damage_inflicted, turn_damage_taken;
|
||||
|
||||
struct by_cth_t {
|
||||
struct hitrate_t {
|
||||
int strikes; //< Number of strike attempts at the given CTH
|
||||
int hits; //< Number of strikes that hit at the given CTH
|
||||
by_cth_t() = default;
|
||||
explicit by_cth_t(const config& cfg);
|
||||
hitrate_t() = default;
|
||||
explicit hitrate_t(const config& cfg);
|
||||
config write() const;
|
||||
};
|
||||
/// A type that maps chance-to-hit percentage to number of hits and strikes at that CTH.
|
||||
typedef std::map<int, by_cth_t> hitrate_map;
|
||||
typedef std::map<int, hitrate_t> hitrate_map;
|
||||
hitrate_map by_cth_inflicted, by_cth_taken;
|
||||
hitrate_map turn_by_cth_inflicted, turn_by_cth_taken;
|
||||
|
||||
|
@ -137,4 +137,4 @@ namespace statistics
|
|||
/// Returns a list of names and stats for each scenario in the current campaign.
|
||||
levels level_stats(const std::string & save_id);
|
||||
} // end namespace statistics
|
||||
std::ostream& operator<<(std::ostream& outstream, const statistics::stats::by_cth_t& by_cth);
|
||||
std::ostream& operator<<(std::ostream& outstream, const statistics::stats::hitrate_t& by_cth);
|
||||
|
|
Loading…
Add table
Reference in a new issue