#include <attack_prediction_display.hpp>


Public Member Functions | |
| battle_prediction_pane (const battle_context &bc, const map_location &attacker_loc, const map_location &defender_loc) | |
| void | draw_contents () |
| bool | left_side () const |
| void | set_selection (int) |
Private Member Functions | |
| void | get_unit_strings (const battle_context_unit_stats &stats, const unit &u, const map_location &u_loc, float u_unscathed, const unit &opp, const map_location &opp_loc, const attack_type *opp_weapon, std::vector< std::string > &left_strings, std::vector< std::string > &right_strings, int &left_strings_width, int &right_strings_width, int &strings_width) |
| int | get_strings_max_length (const std::vector< std::string > &strings) |
| void | get_hp_prob_vector (const std::vector< double > &hp_dist, std::vector< std::pair< int, double > > &hp_prob_vector) |
| void | draw_unit (int x_off, int damage_line_skip, int left_strings_width, const std::vector< std::string > &left_strings, const std::vector< std::string > &right_strings, const std::string &label, int label_width, surface &hp_distrib, int hp_distrib_width) |
| void | get_hp_distrib_surface (const std::vector< std::pair< int, double > > &hp_prob_vector, const battle_context_unit_stats &stats, const battle_context_unit_stats &opp_stats, surface &surf, int &width, int &height) |
| Uint32 | blend_rgb (const surface &surf, unsigned char r, unsigned char g, unsigned char b, unsigned char drop) |
Private Attributes | |
| const battle_context & | bc_ |
| const map_location & | attacker_loc_ |
| const map_location & | defender_loc_ |
| const unit & | attacker_ |
| const unit & | defender_ |
| std::string | attacker_label_ |
| std::string | defender_label_ |
| int | attacker_label_width_ |
| int | defender_label_width_ |
| std::vector< std::string > | attacker_left_strings_ |
| std::vector< std::string > | attacker_right_strings_ |
| std::vector< std::string > | defender_left_strings_ |
| std::vector< std::string > | defender_right_strings_ |
| int | attacker_strings_width_ |
| int | attacker_left_strings_width_ |
| int | attacker_right_strings_width_ |
| int | defender_strings_width_ |
| int | defender_left_strings_width_ |
| int | defender_right_strings_width_ |
| int | units_strings_height_ |
| std::string | hp_distrib_string_ |
| surface | attacker_hp_distrib_ |
| surface | defender_hp_distrib_ |
| int | hp_distrib_string_width_ |
| int | attacker_hp_distrib_width_ |
| int | defender_hp_distrib_width_ |
| int | attacker_hp_distrib_height_ |
| int | defender_hp_distrib_height_ |
| int | hp_distribs_height_ |
| int | attacker_width_ |
| int | defender_width_ |
| int | units_width_ |
| int | dialog_width_ |
| int | dialog_height_ |
Static Private Attributes | |
| static const int | inter_line_gap_ = 3 |
| static const int | inter_column_gap_ = 30 |
| static const int | inter_units_gap_ = 30 |
| static const int | max_hp_distrib_rows_ = 10 |
Definition at line 24 of file attack_prediction_display.hpp.
| battle_prediction_pane::battle_prediction_pane | ( | const battle_context & | bc, | |
| const map_location & | attacker_loc, | |||
| const map_location & | defender_loc | |||
| ) |
Definition at line 48 of file attack_prediction_display.cpp.
References _, attacker_, attacker_hp_distrib_, attacker_hp_distrib_height_, attacker_hp_distrib_width_, attacker_label_, attacker_label_width_, attacker_left_strings_, attacker_left_strings_width_, attacker_loc_, attacker_right_strings_, attacker_right_strings_width_, attacker_strings_width_, attacker_width_, defender_, defender_hp_distrib_, defender_hp_distrib_height_, defender_hp_distrib_width_, defender_label_, defender_label_width_, defender_left_strings_, defender_left_strings_width_, defender_loc_, defender_right_strings_, defender_right_strings_width_, defender_strings_width_, defender_width_, dialog_height_, dialog_width_, battle_context::get_attacker_stats(), battle_context::get_defender_stats(), get_hp_distrib_surface(), get_hp_prob_vector(), get_unit_strings(), hp_distrib_string_, hp_distrib_string_width_, hp_distribs_height_, inter_line_gap_, inter_units_gap_, font::line_width(), gui::widget::set_measurements(), font::SIZE_NORMAL, font::SIZE_PLUS, font::SIZE_SMALL, units_strings_height_, units_width_, and battle_context_unit_stats::weapon.

| Uint32 battle_prediction_pane::blend_rgb | ( | const surface & | surf, | |
| unsigned char | r, | |||
| unsigned char | g, | |||
| unsigned char | b, | |||
| unsigned char | drop | |||
| ) | [private] |
Definition at line 525 of file attack_prediction_display.cpp.
Referenced by get_hp_distrib_surface().

| void battle_prediction_pane::draw_contents | ( | ) | [virtual] |
Reimplemented from gui::widget.
Definition at line 325 of file attack_prediction_display.cpp.
References attacker_hp_distrib_, attacker_hp_distrib_width_, attacker_label_, attacker_label_width_, attacker_left_strings_, attacker_left_strings_width_, attacker_right_strings_, defender_hp_distrib_, defender_hp_distrib_width_, defender_label_, defender_label_width_, defender_left_strings_, defender_left_strings_width_, defender_right_strings_, draw_unit(), inter_units_gap_, and units_width_.

| void battle_prediction_pane::draw_unit | ( | int | x_off, | |
| int | damage_line_skip, | |||
| int | left_strings_width, | |||
| const std::vector< std::string > & | left_strings, | |||
| const std::vector< std::string > & | right_strings, | |||
| const std::string & | label, | |||
| int | label_width, | |||
| surface & | hp_distrib, | |||
| int | hp_distrib_width | |||
| ) | [private] |
Definition at line 339 of file attack_prediction_display.cpp.
References CVideo::blit_surface(), gui::widget::clip_rect(), font::draw_text(), font::draw_text_line(), display::get_screen_surface(), hp_distrib_string_, hp_distrib_string_width_, inter_column_gap_, inter_line_gap_, gui::widget::location(), font::NORMAL_COLOR, resources::screen, font::SIZE_15, font::SIZE_NORMAL, font::SIZE_SMALL, units_width_, and gui::widget::video().
Referenced by draw_contents().


| void battle_prediction_pane::get_hp_distrib_surface | ( | const std::vector< std::pair< int, double > > & | hp_prob_vector, | |
| const battle_context_unit_stats & | stats, | |||
| const battle_context_unit_stats & | opp_stats, | |||
| surface & | surf, | |||
| int & | width, | |||
| int & | height | |||
| ) | [private] |
Definition at line 408 of file attack_prediction_display.cpp.
References blend_rgb(), gui::widget::clip_rect(), create_neutral_surface(), gui2::create_rect(), font::draw_text_line(), format_prob(), battle_context_unit_stats::hp, font::line_width(), font::NORMAL_COLOR, battle_context_unit_stats::petrifies, sdl_fill_rect(), and font::SIZE_SMALL.
Referenced by battle_prediction_pane().


| void battle_prediction_pane::get_hp_prob_vector | ( | const std::vector< double > & | hp_dist, | |
| std::vector< std::pair< int, double > > & | hp_prob_vector | |||
| ) | [private] |
Definition at line 292 of file attack_prediction_display.cpp.
References max_hp_distrib_rows_, and sort().
Referenced by battle_prediction_pane().


| int battle_prediction_pane::get_strings_max_length | ( | const std::vector< std::string > & | strings | ) | [private] |
Definition at line 282 of file attack_prediction_display.cpp.
References font::line_width(), and font::SIZE_NORMAL.
Referenced by get_unit_strings().


| void battle_prediction_pane::get_unit_strings | ( | const battle_context_unit_stats & | stats, | |
| const unit & | u, | |||
| const map_location & | u_loc, | |||
| float | u_unscathed, | |||
| const unit & | opp, | |||
| const map_location & | opp_loc, | |||
| const attack_type * | opp_weapon, | |||
| std::vector< std::string > & | left_strings, | |||
| std::vector< std::string > & | right_strings, | |||
| int & | left_strings_width, | |||
| int & | right_strings_width, | |||
| int & | strings_width | |||
| ) | [private] |
Definition at line 142 of file attack_prediction_display.cpp.
References _, unit_abilities::ADD, unit::alignment(), battle_context_unit_stats::backstab_pos, battle_context_unit_stats::chance_to_hit, combat_modifier(), battle_context_unit_stats::damage, attack_type::damage(), unit::damage_from(), format_prob(), attack_type::get_specials(), get_strings_max_length(), inter_column_gap_, battle_context_unit_stats::is_attacker, unit::is_fearless(), battle_context_unit_stats::is_slowed, unit_abilities::MUL, attack_type::name(), battle_context_unit_stats::num_blows, unit_abilities::SET, attack_type::set_specials_context(), utils::signed_percent(), string_table, attack_type::type(), under_leadership(), utils::unicode_en_dash, resources::units, font::weapon, and battle_context_unit_stats::weapon.
Referenced by battle_prediction_pane().


| bool battle_prediction_pane::left_side | ( | ) | const [inline, virtual] |
Implements gui::preview_pane.
Definition at line 36 of file attack_prediction_display.hpp.
| void battle_prediction_pane::set_selection | ( | int | ) | [inline, virtual] |
Implements gui::preview_pane.
Definition at line 39 of file attack_prediction_display.hpp.
const unit& battle_prediction_pane::attacker_ [private] |
Definition at line 45 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
Definition at line 65 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
int battle_prediction_pane::attacker_hp_distrib_height_ [private] |
Definition at line 68 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
int battle_prediction_pane::attacker_hp_distrib_width_ [private] |
Definition at line 67 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
std::string battle_prediction_pane::attacker_label_ [private] |
Definition at line 55 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
int battle_prediction_pane::attacker_label_width_ [private] |
Definition at line 56 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
std::vector<std::string> battle_prediction_pane::attacker_left_strings_ [private] |
Definition at line 58 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
int battle_prediction_pane::attacker_left_strings_width_ [private] |
Definition at line 60 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
const map_location& battle_prediction_pane::attacker_loc_ [private] |
Definition at line 43 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
std::vector<std::string> battle_prediction_pane::attacker_right_strings_ [private] |
Definition at line 58 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
int battle_prediction_pane::attacker_right_strings_width_ [private] |
Definition at line 60 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
int battle_prediction_pane::attacker_strings_width_ [private] |
Definition at line 60 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
int battle_prediction_pane::attacker_width_ [private] |
Definition at line 70 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
const battle_context& battle_prediction_pane::bc_ [private] |
Definition at line 42 of file attack_prediction_display.hpp.
const unit& battle_prediction_pane::defender_ [private] |
Definition at line 46 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
Definition at line 65 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
int battle_prediction_pane::defender_hp_distrib_height_ [private] |
Definition at line 68 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
int battle_prediction_pane::defender_hp_distrib_width_ [private] |
Definition at line 67 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
std::string battle_prediction_pane::defender_label_ [private] |
Definition at line 55 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
int battle_prediction_pane::defender_label_width_ [private] |
Definition at line 56 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
std::vector<std::string> battle_prediction_pane::defender_left_strings_ [private] |
Definition at line 59 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
int battle_prediction_pane::defender_left_strings_width_ [private] |
Definition at line 61 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
const map_location& battle_prediction_pane::defender_loc_ [private] |
Definition at line 44 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
std::vector<std::string> battle_prediction_pane::defender_right_strings_ [private] |
Definition at line 59 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
int battle_prediction_pane::defender_right_strings_width_ [private] |
Definition at line 61 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
int battle_prediction_pane::defender_strings_width_ [private] |
Definition at line 61 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
int battle_prediction_pane::defender_width_ [private] |
Definition at line 70 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
int battle_prediction_pane::dialog_height_ [private] |
Definition at line 71 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
int battle_prediction_pane::dialog_width_ [private] |
Definition at line 71 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
std::string battle_prediction_pane::hp_distrib_string_ [private] |
Definition at line 64 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_unit().
int battle_prediction_pane::hp_distrib_string_width_ [private] |
Definition at line 66 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_unit().
int battle_prediction_pane::hp_distribs_height_ [private] |
Definition at line 68 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
const int battle_prediction_pane::inter_column_gap_ = 30 [static, private] |
Definition at line 50 of file attack_prediction_display.hpp.
Referenced by draw_unit(), and get_unit_strings().
const int battle_prediction_pane::inter_line_gap_ = 3 [static, private] |
Definition at line 49 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_unit().
const int battle_prediction_pane::inter_units_gap_ = 30 [static, private] |
Definition at line 51 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
const int battle_prediction_pane::max_hp_distrib_rows_ = 10 [static, private] |
Definition at line 52 of file attack_prediction_display.hpp.
Referenced by get_hp_prob_vector().
int battle_prediction_pane::units_strings_height_ [private] |
Definition at line 62 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
int battle_prediction_pane::units_width_ [private] |
Definition at line 70 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), draw_contents(), and draw_unit().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:13:11 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |