#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) |
Public Member Functions inherited from gui::preview_pane | |
preview_pane (CVideo &video) | |
virtual | ~preview_pane () |
virtual bool | show_above () const |
virtual sdl_handler_vector | handler_members () |
Public Member Functions inherited from gui::widget | |
SDL_Rect const & | location () const |
virtual void | set_location (SDL_Rect const &rect) |
void | set_location (int x, int y) |
void | set_width (int w) |
void | set_height (int h) |
void | set_measurements (int w, int h) |
int | width () const |
int | height () const |
bool | focus (const SDL_Event *event) |
void | set_focus (bool focus) |
virtual void | hide (bool value=true) |
bool | hidden () const |
virtual void | enable (bool new_val=true) |
bool | enabled () const |
void | set_clip_rect (const SDL_Rect &rect) |
void | set_volatile (bool val=true) |
void | set_dirty (bool dirty=true) |
bool | dirty () const |
const std::string & | id () const |
void | set_id (const std::string &id) |
void | set_help_string (const std::string &str) |
void | set_tooltip_string (const std::string &str) |
virtual void | process_help_string (int mousex, int mousey) |
virtual void | process_tooltip_string (int mousex, int mousey) |
Public Member Functions inherited from events::sdl_handler | |
virtual void | process_event () |
virtual bool | requires_event_focus (const SDL_Event *=nullptr) const |
virtual void | join () |
virtual void | join (context &c) |
virtual void | join_same (sdl_handler *parent) |
virtual void | leave () |
virtual void | join_global () |
virtual void | leave_global () |
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) |
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 |
Additional Inherited Members | |
Protected Member Functions inherited from gui::widget | |
widget (widget const &o) | |
widget (CVideo &video, const bool auto_join=true) | |
virtual | ~widget () |
void | bg_register (SDL_Rect const &rect) |
void | bg_restore () const |
void | bg_restore (SDL_Rect const &rect) const |
void | bg_update () |
void | bg_cancel () |
CVideo & | video () const |
virtual void | draw () |
virtual void | update_location (SDL_Rect const &rect) |
const SDL_Rect * | clip_rect () const |
virtual sdl_handler_vector | member_handlers () |
virtual void | handle_event (SDL_Event const &) |
virtual void | handle_window_event (SDL_Event const &event) |
bool | mouse_locked () const |
void | aquire_mouse_lock () |
void | free_mouse_lock () |
Protected Member Functions inherited from events::sdl_handler | |
sdl_handler (const bool auto_join=true) | |
virtual | ~sdl_handler () |
Protected Attributes inherited from gui::widget | |
bool | focus_ |
Definition at line 27 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 51 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_, combatant::fight(), 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.
|
virtual |
Reimplemented from gui::widget.
Definition at line 327 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_.
|
private |
Definition at line 341 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_, i, 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().
|
private |
Definition at line 410 of file attack_prediction_display.cpp.
References blend_rgba(), gui::widget::clip_rect(), create_neutral_surface(), sdl::create_rect(), font::draw_text_line(), sdl::fill_rect(), format_prob(), battle_context_unit_stats::hp, i, font::line_width(), font::NORMAL_COLOR, battle_context_unit_stats::petrifies, SDL_SetAlpha(), and font::SIZE_SMALL.
Referenced by battle_prediction_pane().
|
private |
Definition at line 294 of file attack_prediction_display.cpp.
References i, max_hp_distrib_rows_, and sort().
Referenced by battle_prediction_pane().
|
private |
Definition at line 284 of file attack_prediction_display.cpp.
References i, font::line_width(), and font::SIZE_NORMAL.
Referenced by get_unit_strings().
|
private |
Definition at line 144 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(), attack_type::damage(), battle_context_unit_stats::damage, unit::damage_from(), format_prob(), resources::gameboard, attack_type::get_specials(), get_strings_max_length(), i, int(), 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().
|
inlinevirtual |
Implements gui::preview_pane.
Definition at line 39 of file attack_prediction_display.hpp.
Implements gui::preview_pane.
Definition at line 42 of file attack_prediction_display.hpp.
|
private |
Definition at line 47 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 67 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 70 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 69 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 57 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 58 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 60 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 62 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 45 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 60 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 62 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 62 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 72 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 48 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 67 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 70 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 69 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 57 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 58 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 61 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 63 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 46 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 61 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
private |
Definition at line 63 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 63 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 72 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 73 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 73 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 66 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_unit().
|
private |
Definition at line 68 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_unit().
|
private |
Definition at line 70 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
staticprivate |
Definition at line 52 of file attack_prediction_display.hpp.
Referenced by draw_unit(), and get_unit_strings().
|
staticprivate |
Definition at line 51 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_unit().
|
staticprivate |
Definition at line 53 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), and draw_contents().
|
staticprivate |
Definition at line 54 of file attack_prediction_display.hpp.
Referenced by get_hp_prob_vector().
|
private |
Definition at line 64 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane().
|
private |
Definition at line 72 of file attack_prediction_display.hpp.
Referenced by battle_prediction_pane(), draw_contents(), and draw_unit().