The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
unit_attack.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2016 by Mark de Wever <[email protected]>
3  Part of the Battle for Wesnoth Project http://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 #ifndef GUI_DIALOGS_UNIT_ATTACK_HPP_INCLUDED
16 #define GUI_DIALOGS_UNIT_ATTACK_HPP_INCLUDED
17 
18 #include "actions/attack.hpp"
19 #include "gui/dialogs/dialog.hpp"
20 #include "units/map.hpp"
21 
22 namespace gui2
23 {
24 
25 class tunit_attack : public tdialog
26 {
27 public:
28  tunit_attack(const unit_map::iterator& attacker_itor,
29  const unit_map::iterator& defender_itor,
30  const std::vector<battle_context>& weapons,
31  const int best_weapon);
32 
33  /***** ***** ***** setters / getters for members ***** ****** *****/
34 
35  int get_selected_weapon() const
36  {
37  return selected_weapon_;
38  }
39 
40 private:
41  /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
42  virtual const std::string& window_id() const;
43 
44  /** Inherited from tdialog. */
45  void pre_show(twindow& window);
46 
47  /** Inherited from tdialog. */
48  void post_show(twindow& window);
49 
50  void profile_button_callback(twindow& window, const std::string& type);
51 
52  void damage_calc_callback(twindow& window);
53 
54  /** The index of the selected weapon. */
56 
57  /** Iterator pointing to the attacker. */
59 
60  /** Iterator pointing to the defender. */
62 
63  /** List of all battle contexts used for getting the weapons. */
64  std::vector<battle_context> weapons_;
65 
66  /** The best weapon, aka the one high-lighted. */
68 };
69 
70 } // namespace gui2
71 
72 #endif
void post_show(twindow &window)
Inherited from tdialog.
Various functions that implement attacks and attack calculations.
void damage_calc_callback(twindow &window)
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
int best_weapon_
The best weapon, aka the one high-lighted.
Definition: unit_attack.hpp:67
std::vector< battle_context > weapons_
List of all battle contexts used for getting the weapons.
Definition: unit_attack.hpp:64
int selected_weapon_
The index of the selected weapon.
Definition: unit_attack.hpp:55
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
Abstract base class for all dialogs.
Definition: dialog.hpp:121
void pre_show(twindow &window)
Inherited from tdialog.
unit_map::iterator attacker_itor_
Iterator pointing to the attacker.
Definition: unit_attack.hpp:58
void profile_button_callback(twindow &window, const std::string &type)
tunit_attack(const unit_map::iterator &attacker_itor, const unit_map::iterator &defender_itor, const std::vector< battle_context > &weapons, const int best_weapon)
Definition: unit_attack.cpp:75
virtual const std::string & window_id() const
Inherited from tdialog, implemented by REGISTER_DIALOG.
int get_selected_weapon() const
Definition: unit_attack.hpp:35
unit_map::iterator defender_itor_
Iterator pointing to the defender.
Definition: unit_attack.hpp:61
GLsizei const GLcharARB ** string
Definition: glew.h:4503