The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
statistics_dialog.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 - 2025
3 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY.
11
12 See the COPYING file for more details.
13*/
14
15#pragma once
16
18#include "statistics.hpp"
19
20class team;
21
22namespace gui2::dialogs
23{
25{
26public:
27 statistics_dialog(statistics_t& statistics, const team& current_team);
28
30
31private:
32 virtual const std::string& window_id() const override;
33
34 virtual void pre_show() override;
35
36 /**
37 * Picks out the stats structure that was selected for displaying.
38 */
39 inline const statistics_t::stats& current_stats();
40
41 void add_stat_row(const std::string& type, const statistics_t::stats::str_int_map& value, const bool has_cost = true);
42
43 /** Add a row to the Damage table */
44 void add_damage_row(
45 const std::string& type,
46 const long long& damage,
47 const long long& expected,
48 const long long& turn_damage,
49 const long long& turn_expected,
50 const bool show_this_turn);
51
52 /**
53 * Add a row to the Hits table
54 * @param type
55 * @param more_is_better True for "Inflicted" and false for "Taken". Affects coloring.
56 * @param by_cth
57 * @param turn_by_cth
58 * @param show_this_turn
59 */
60 void add_hits_row(
61 const std::string& type,
62 const bool more_is_better,
64 const statistics_t::stats::hitrate_map& turn_by_cth,
65 const bool show_this_turn);
66
67 void update_lists();
68
70 void on_scenario_select();
71
73
76
77 std::size_t selection_index_;
78
79 std::vector<const statistics_t::stats::str_int_map*> main_stat_table_;
80};
81
82} // namespace gui2::dialogs
Abstract base class for all modal dialogs.
virtual const std::string & window_id() const override
The ID of the window to build.
const statistics_t::stats & current_stats()
Picks out the stats structure that was selected for displaying.
const statistics_t::levels scenarios_
virtual void pre_show() override
Actions to be taken before showing the window.
void add_damage_row(const std::string &type, const long long &damage, const long long &expected, const long long &turn_damage, const long long &turn_expected, const bool show_this_turn)
Add a row to the Damage table.
const statistics_t::stats campaign_
void add_hits_row(const std::string &type, const bool more_is_better, const statistics_t::stats::hitrate_map &by_cth, const statistics_t::stats::hitrate_map &turn_by_cth, const bool show_this_turn)
Add a row to the Hits table.
void add_stat_row(const std::string &type, const statistics_t::stats::str_int_map &value, const bool has_cost=true)
std::vector< const statistics_t::stats::str_int_map * > main_stat_table_
static const std::string & type()
Static type getter that does not rely on the widget being constructed.
std::vector< std::pair< const std::string *, const stats * > > levels
Stats (and name) for each scenario.
This class stores all the data for a single 'side' (in game nomenclature).
Definition team.hpp:74
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
std::unique_ptr< MIX_Audio, decltype(&MIX_DestroyAudio)> value
Definition sound.cpp:139
std::map< int, hitrate_t > hitrate_map
A type that maps chance-to-hit percentage to number of hits and strikes at that CTH.
std::map< std::string, int > str_int_map