38 std::vector<std::string>
table;
39 for(statistics::stats::str_int_map::const_iterator
i = m.begin();
i != m.end(); ++
i) {
43 std::stringstream str;
47 str <<
"~RC(" << type->
flag_rgb() <<
">" << team <<
")";
50 table.push_back(str.str());
57 void make_damage_line(std::vector<std::string>&
items,
const std::string& header,
58 const long long& damage,
const long long& expected,
59 const long long& turn_damage,
const long long& turn_expected,
64 long long dsa = shift * damage - expected;
65 long long dst = shift * turn_damage - turn_expected;
67 std::ostringstream str;
70 << (expected * 10 + shift / 2) / shift * 0.1
72 << ((dsa < 0) ^ (expected < 0) ?
"" :
"+")
73 << (expected == 0 ? 0 : 100 * dsa / expected) <<
'%';
74 if ( show_this_turn ) {
77 << turn_damage <<
" / "
78 << (turn_expected * 10 + shift / 2) / shift * 0.1
80 << ((dst < 0) ^ (turn_expected < 0) ?
"" :
"+")
81 << (turn_expected == 0 ? 0 : 100 * dst / turn_expected) <<
'%';
83 items.push_back(str.str());
101 bool has_details = sel < 5 && sel >= 0 &&
unit_count_[sel] > 0;
111 std::vector<std::string> items_sub;
117 title =
_(
"Recruits");
121 title =
_(
"Recalls");
125 title =
_(
"Advancements");
151 if (items_sub.empty() ==
false) {
163 const unsigned int team,
167 detail_btn_(new
gui::standard_dialog_button(disp.video(),
_(
"Details"), 0 , false)),
168 toggle_btn_(new
gui::dialog_button(disp.video(),
"",
gui::button::TYPE_PRESS,
BUTTON_TOGGLE)),
169 scene_btn_(new
gui::dialog_button(disp.video(),
_(
"Select Scenario"),
gui::button::TYPE_PRESS,
BUTTON_SCENE)),
170 player_name_(player),
173 scenario_index_(scenarios_.
size() - 1),
215 const bool show_this_turn =
219 std::vector<std::string>
items;
222 std::stringstream str;
226 items.push_back(str.str());
230 std::stringstream str;
238 items.push_back(str.str());
241 std::stringstream str;
249 items.push_back(str.str());
252 std::stringstream str;
256 items.push_back(str.str());
259 std::stringstream str;
267 items.push_back(str.str());
270 std::stringstream str;
278 items.push_back(str.str());
282 std::stringstream str;
285 if ( show_this_turn ) {
290 items.push_back(str.str());
293 make_damage_line(items,
_(
"Inflicted"),
297 make_damage_line(items,
_(
"Taken"),
314 std::vector<std::string>
names;
322 -1,
nullptr, loc.x, loc.y + loc.h);
const statistics::stats & current_stats()
Picks out the stats structure that was selected for displaying.
long long damage_inflicted
void set_result(const int result)
const t_string & type_name() const
The name of the unit in the current language setting.
std::vector< int > unit_count_
int sum_str_int_map(const stats::str_int_map &m)
gui::dialog_button * toggle_btn_
GLuint GLuint GLsizei GLenum type
static const int BUTTON_TOGGLE
void add_button(dialog_button *const btn, BUTTON_LOCATION loc)
long long turn_damage_taken
const statistics::stats campaign_
void display_stats(bool campaign)
Fills in the text to be displayed in the dialog.
int sum_cost_str_int_map(const stats::str_int_map &m)
unit_type_data unit_types
const std::string & image() const
const std::vector< std::string > items
int show(int xloc, int yloc)
statistics_dialog(game_display &disp, const std::string &title, const unsigned int team, const std::string &team_id, const std::string &player)
long long expected_damage_taken
long long turn_expected_damage_inflicted
const statistics::levels scenarios_
This class stores all the data for a single 'side' (in game nomenclature).
gui::dialog_button * scene_btn_
static UNUSEDNOWARN std::string _(const char *str)
const std::string & flag_rgb() const
static const int decimal_shift
void set_menu(menu *const m)
void action(gui::dialog_process_info &dp_info)
levels level_stats(const std::string &save_id)
Returns a list of names and stats for each scenario in the current campaign.
virtual dimension_measurements layout(int xloc=-1, int yloc=-1)
int show_dialog(CVideo &video, surface image, const std::string &caption, const std::string &message, DIALOG_TYPE type, const std::vector< std::string > *menu_items, const std::vector< preview_pane * > *preview_panes, const std::string &text_widget_label, std::string *text_widget_text, const int text_widget_max_chars, std::vector< check_item > *options, int xloc, int yloc, const dialog_frame::style *dialog_style, std::vector< dialog_button_info > *action_buttons, const menu::sorter *sorter, menu::style *menu_style)
void set_menu_items(const std::vector< std::string > &menu_items, bool keep_selection=false)
Changes (or sets, if not previously set) the dialog's menu items to the provided list.
GLuint const GLuint * names
stats calculate_stats(const std::string &save_id)
long long turn_damage_inflicted
void do_scene_selection()
Implements the scenario selection popup.
long long expected_damage_inflicted
char const HEADING_PREFIX
static const int BUTTON_SCENE
char const COLUMN_SEPARATOR
static bool use_campaign_
std::map< std::string, int > str_int_map
gui::dialog_button * detail_btn_
CVideo & video()
Gets the underlying screen object.
long long turn_expected_damage_taken
const unit_type * find(const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const
Finds a unit_type by its id() and makes sure it is built to the specified level.
GLenum GLsizei GLenum GLenum const GLvoid * table
GLsizei const GLcharARB ** string