#include <recruit.hpp>

Public Member Functions | |
| recruit (size_t team_index, bool hidden, const std::string &unit_name, const map_location &recruit_hex) | |
| recruit (config const &, bool hidden) | |
| virtual | ~recruit () |
| virtual std::ostream & | print (std::ostream &s) const |
| virtual void | accept (visitor &v) |
| virtual void | execute (bool &success, bool &complete) |
| Output parameters: success: Whether or not to continue an execute-all after this execution complete: Whether or not to delete this action after execution. More... | |
| virtual error | check_validity () const |
| Check the validity of the action. More... | |
| virtual void | apply_temp_modifier (unit_map &unit_map) |
| Applies temporarily the result of this action to the specified unit map. More... | |
| virtual void | remove_temp_modifier (unit_map &unit_map) |
| Removes the result of this action from the specified unit map. More... | |
| virtual void | draw_hex (map_location const &hex) |
| Gets called by display when drawing a hex, to allow actions to draw to the screen. More... | |
| virtual void | redraw () |
| Redrawing function, called each time the action situation might have changed. More... | |
| virtual map_location | get_numbering_hex () const |
| virtual unit_ptr | get_unit () const |
| virtual fake_unit_ptr | get_fake_unit () |
| map_location const | get_recruit_hex () const |
| virtual config | to_config () const |
| Constructs and returns a config object representing this object. More... | |
Public Member Functions inherited from wb::action | |
| action (size_t team_index, bool hidden) | |
| action (config const &, bool hidden) | |
| virtual | ~action () |
| void | hide () |
| Sets whether or not the action should be drawn on the screen. More... | |
| void | show () |
| bool | hidden () const |
| bool | is_numbering_hex (const map_location &hex) const |
| Indicates whether this hex is the preferred hex to draw the numbering for this action. More... | |
| size_t | get_unit_id () const |
| Returns the id of the unit targeted by this action. More... | |
| size_t | team_index () const |
| Returns the index of the team that owns this action. More... | |
| int | side_number () const |
| Returns the number of the side that owns this action, i.e. More... | |
| bool | valid () |
| Returns whether this action is valid or not. More... | |
Protected Member Functions | |
| boost::shared_ptr< recruit > | shared_from_this () |
Protected Attributes | |
| std::string | unit_name_ |
| map_location | recruit_hex_ |
| unit_ptr | temp_unit_ |
| fake_unit_ptr | fake_unit_ |
| int | cost_ |
Private Member Functions | |
| void | init () |
| virtual void | do_hide () |
| Called by the non-virtual hide() and show(), respectively. More... | |
| virtual void | do_show () |
| unit_ptr | create_corresponding_unit () |
Additional Inherited Members | |
Public Types inherited from wb::action | |
| enum | error { OK, INVALID_LOCATION, NO_UNIT, UNIT_CHANGED, LOCATION_OCCUPIED, TOO_FAR, NO_TARGET, NO_ATTACK_LEFT, NOT_AN_ENEMY, UNIT_UNAVAILABLE, NOT_ENOUGH_GOLD, NO_LEADER } |
| Possible errors. More... | |
Static Public Member Functions inherited from wb::action | |
| static action_ptr | from_config (config const &, bool hidden) |
| Constructs an object of a subclass of wb::action using a config. More... | |
Definition at line 33 of file recruit.hpp.
| wb::recruit::recruit | ( | size_t | team_index, |
| bool | hidden, | ||
| const std::string & | unit_name, | ||
| const map_location & | recruit_hex | ||
| ) |
Definition at line 56 of file recruit.cpp.
References init().
| wb::recruit::recruit | ( | config const & | cfg, |
| bool | hidden | ||
| ) |
Definition at line 67 of file recruit.cpp.
References create_corresponding_unit(), fake_unit_, unit_type_data::find(), init(), fake_unit_ptr::reset(), temp_unit_, unit_name_, and unit_types.
|
virtual |
Definition at line 97 of file recruit.cpp.
Implements wb::action.
Definition at line 101 of file recruit.cpp.
References shared_from_this(), and wb::visitor::visit().
Applies temporarily the result of this action to the specified unit map.
Implements wb::action.
Definition at line 121 of file recruit.cpp.
References cost_, DBG_WB, unit_map::insert(), display::invalidate_game_status(), recruit_hex_, resources::screen, wb::action::team_index(), resources::teams, temp_unit_, and wb::action::valid().
|
virtual |
Check the validity of the action.
| OK | if there isn't any error (the action can be executed.) |
Implements wb::action.
Definition at line 182 of file recruit.cpp.
References gui2::event::find(), wb::find_recruiter(), get_recruit_hex(), wb::action::LOCATION_OCCUPIED, wb::action::NO_LEADER, wb::action::NOT_ENOUGH_GOLD, wb::action::OK, recruit_hex_, wb::action::team_index(), temp_unit_, unit_name_, wb::action::UNIT_UNAVAILABLE, and resources::units.
|
private |
Definition at line 169 of file recruit.cpp.
References unit_type_data::find(), wb::action::team_index(), unit_name_, and unit_types.
Referenced by recruit().
|
privatevirtual |
Called by the non-virtual hide() and show(), respectively.
Reimplemented from wb::action.
Definition at line 222 of file recruit.cpp.
References fake_unit_.
|
privatevirtual |
|
virtual |
Gets called by display when drawing a hex, to allow actions to draw to the screen.
Implements wb::action.
Definition at line 147 of file recruit.cpp.
References cost_, display::draw_text_in_hex(), gui::font_size, display::LAYER_ACTIONS_NUMBERING, recruit_hex_, resources::screen, and utils::unicode_minus.
|
virtual |
Output parameters: success: Whether or not to continue an execute-all after this execution complete: Whether or not to delete this action after execution.
Implements wb::action.
Definition at line 106 of file recruit.cpp.
References resources::controller, cost_, events::menu_handler::do_recruit(), fake_unit_, play_controller::get_menu_handler(), recruit_hex_, wb::action::team_index(), resources::teams, unit_name_, and wb::action::valid().
|
inlinevirtual |
Implements wb::action.
Definition at line 72 of file recruit.hpp.
References fake_unit_.
|
inlinevirtual |
Implements wb::action.
Definition at line 67 of file recruit.hpp.
References recruit_hex_.
|
inline |
|
inlinevirtual |
Implements wb::action.
Definition at line 70 of file recruit.hpp.
References temp_unit_.
|
private |
Definition at line 86 of file recruit.cpp.
References cost_, fake_unit_, resources::fake_units, fake_unit_ptr::place_on_fake_unit_manager(), and recruit_hex_.
Referenced by recruit().
|
virtual |
Implements wb::action.
Definition at line 50 of file recruit.cpp.
References recruit_hex_, and unit_name_.
|
virtual |
Redrawing function, called each time the action situation might have changed.
Reimplemented from wb::action.
Definition at line 163 of file recruit.cpp.
References display::invalidate(), recruit_hex_, and resources::screen.
Removes the result of this action from the specified unit map.
Implements wb::action.
Definition at line 140 of file recruit.cpp.
References unit_map::extract(), recruit_hex_, and temp_unit_.
|
inlineprotected |
Definition at line 80 of file recruit.hpp.
Referenced by accept().
|
virtual |
Constructs and returns a config object representing this object.
Reimplemented from wb::action.
Definition at line 206 of file recruit.cpp.
References config::add_child(), recruit_hex_, wb::action::to_config(), unit_name_, map_location::x, and map_location::y.
|
protected |
Definition at line 89 of file recruit.hpp.
Referenced by apply_temp_modifier(), draw_hex(), execute(), and init().
|
protected |
Definition at line 88 of file recruit.hpp.
Referenced by do_hide(), do_show(), execute(), get_fake_unit(), init(), and recruit().
|
protected |
Definition at line 85 of file recruit.hpp.
Referenced by apply_temp_modifier(), check_validity(), draw_hex(), execute(), get_numbering_hex(), get_recruit_hex(), init(), print(), redraw(), remove_temp_modifier(), and to_config().
|
protected |
Definition at line 87 of file recruit.hpp.
Referenced by apply_temp_modifier(), check_validity(), get_unit(), recruit(), and remove_temp_modifier().
|
protected |
Definition at line 84 of file recruit.hpp.
Referenced by check_validity(), create_corresponding_unit(), execute(), print(), recruit(), and to_config().
1.8.8