38 const
unit_map::iterator& defender_itor,
40 const
int best_weapon,
43 , selected_weapon_(-1)
44 , attacker_itor_(attacker_itor)
45 , defender_itor_(defender_itor)
46 , weapons_(
std::move(weapons))
47 , best_weapon_(best_weapon)
48 , bc_widget_data_vector_(bc_widget_data_vector)
54 const std::size_t index = find_widget<listbox>(
"weapon_list").get_selected_row();
60 connect_signal_mouse_left_click(
61 find_widget<button>(
"damage_calculation"),
64 find_widget<unit_preview_pane>(
"attacker_pane")
67 find_widget<unit_preview_pane>(
"defender_pane")
72 listbox& weapon_list = find_widget<listbox>(
"weapon_list");
Computes the statistics of a battle between an attacker and a defender unit.
Abstract base class for all modal dialogs.
virtual void post_show() override
Actions to be taken after the window has been shown.
int selected_weapon_
The index of the selected weapon.
unit_map::iterator defender_itor_
Iterator pointing to the defender.
int best_weapon_
The best weapon, aka the one high-lighted.
std::vector< gui2::widget_data > bc_widget_data_vector_
virtual void pre_show() override
Actions to be taken before showing the window.
unit_map::iterator attacker_itor_
Iterator pointing to the attacker.
void damage_calc_callback()
std::vector< battle_context > weapons_
List of all battle contexts used for getting the weapons.
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
bool select_row(const unsigned row, const bool select=true)
Selects a row.
unsigned get_item_count() const
Returns the number of items in the listbox.
void keyboard_capture(widget *widget)
Container associating units to locations.
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
std::map< std::string, widget_item > widget_data
@ OK
Dialog was closed with the OK button.
pointer get_shared_ptr() const
This is exactly the same as operator-> but it's slightly more readable, and can replace &*iter syntax...