#include <recall.hpp>
Public Member Functions | |
recall (std::size_t team_index, bool hidden, const unit &unit, const map_location &recall_hex) | |
recall (const config &, bool hidden) | |
virtual | ~recall () |
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 (const map_location &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 |
Indicates whether this hex is the preferred hex to draw the numbering for this action. More... | |
virtual unit_ptr | get_unit () const |
virtual bool | places_new_unit () const |
Returns true for recall and recruit actions. More... | |
virtual fake_unit_ptr | get_fake_unit () |
map_location const | get_recall_hex () const |
virtual config | to_config () const |
Public Member Functions inherited from wb::action | |
action (std::size_t team_index, bool hidden) | |
action (const config &, 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... | |
virtual std::size_t | get_unit_id () const |
Returns the id of the unit targeted by this action. More... | |
std::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 | |
std::shared_ptr< recall > | shared_from_this () |
Private Member Functions | |
void | init () |
virtual void | do_hide () |
Called by the non-virtual hide() and show(), respectively. More... | |
virtual void | do_show () |
Private Attributes | |
unit_ptr | temp_unit_ |
map_location | recall_hex_ |
fake_unit_ptr | fake_unit_ |
int | original_mp_ |
int | original_ap_ |
int | original_recall_pos_ |
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 (const config &, bool hidden) |
Constructs an object of a subclass of wb::action using a config. More... | |
Definition at line 28 of file recall.hpp.
wb::recall::recall | ( | std::size_t | team_index, |
bool | hidden, | ||
const unit & | unit, | ||
const map_location & | recall_hex | ||
) |
Definition at line 58 of file recall.cpp.
References init().
wb::recall::recall | ( | const config & | cfg, |
bool | hidden | ||
) |
Definition at line 70 of file recall.cpp.
References schema_validation::at(), fake_unit_, resources::gameboard, init(), actions::recall_unit(), fake_unit_ptr::reset(), wb::action::team_index(), and temp_unit_.
|
virtual |
Definition at line 107 of file recall.cpp.
|
virtual |
Implements wb::action.
Definition at line 111 of file recall.cpp.
References shared_from_this(), and wb::visitor::visit().
|
virtual |
Applies temporarily the result of this action to the specified unit map.
Implements wb::action.
Definition at line 138 of file recall.cpp.
References DBG_WB, resources::gameboard, display::get_singleton(), unit_map::insert(), display::invalidate_game_status(), original_ap_, original_mp_, original_recall_pos_, recall_hex_, wb::action::team_index(), game_board::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 216 of file recall.cpp.
References wb::any_recruiter(), resources::gameboard, get_recall_hex(), wb::action::LOCATION_OCCUPIED, wb::action::NO_LEADER, wb::action::NOT_ENOUGH_GOLD, map_location::null_location(), wb::action::OK, game_config::recall_cost, unit::recall_filter(), recall_hex_, wb::action::team_index(), temp_unit_, and wb::action::UNIT_UNAVAILABLE.
|
privatevirtual |
Called by the non-virtual hide() and show(), respectively.
Reimplemented from wb::action.
Definition at line 260 of file recall.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 188 of file recall.cpp.
References actions_numbering, display::draw_text_in_hex(), resources::gameboard, display::get_singleton(), get_unit(), unit::recall_cost(), recall_hex_, wb::action::team_index(), game_board::teams(), and font::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 116 of file recall.cpp.
References fake_unit_, resources::gameboard, replay_helper::get_recall(), team::get_side_actions(), map_location::null_location(), team::recall_cost(), recall_hex_, synced_context::run_and_throw(), wb::action::team_index(), game_board::teams(), temp_unit_, and wb::action::valid().
|
inlinevirtual |
Implements wb::action.
Definition at line 68 of file recall.hpp.
References fake_unit_.
Referenced by wb::highlighter::unhighlight_visitor::visit().
|
inlinevirtual |
Indicates whether this hex is the preferred hex to draw the numbering for this action.
Implements wb::action.
Definition at line 62 of file recall.hpp.
References recall_hex_.
|
inline |
Definition at line 70 of file recall.hpp.
References recall_hex_.
Referenced by wb::manager::allow_leader_to_move(), and check_validity().
|
inlinevirtual |
Implements wb::action.
Definition at line 65 of file recall.hpp.
References temp_unit_.
Referenced by draw_hex().
|
private |
Definition at line 98 of file recall.cpp.
References fake_unit_, resources::fake_units, fake_unit_ptr::place_on_fake_unit_manager(), and recall_hex_.
Referenced by recall().
|
inlinevirtual |
Returns true for recall and recruit actions.
Reimplemented from wb::action.
Definition at line 66 of file recall.hpp.
|
virtual |
Implements wb::action.
Definition at line 52 of file recall.cpp.
References fake_unit_, recall_hex_, and s.
Referenced by wb::operator<<().
|
virtual |
Redrawing function, called each time the action situation might have changed.
Reimplemented from wb::action.
Definition at line 211 of file recall.cpp.
References display::get_singleton(), display::invalidate(), and recall_hex_.
|
virtual |
Removes the result of this action from the specified unit map.
Implements wb::action.
Definition at line 174 of file recall.cpp.
References unit_map::extract(), resources::gameboard, original_ap_, original_mp_, original_recall_pos_, recall_hex_, wb::action::team_index(), game_board::teams(), and temp_unit_.
|
inlineprotected |
Definition at line 76 of file recall.hpp.
Referenced by accept().
|
virtual |
Reimplemented from wb::action.
Definition at line 244 of file recall.cpp.
References config::add_child(), recall_hex_, temp_unit_, wb::action::to_config(), map_location::wml_x(), and map_location::wml_y().
|
private |
Definition at line 89 of file recall.hpp.
Referenced by do_hide(), do_show(), execute(), get_fake_unit(), init(), print(), and recall().
|
private |
Definition at line 92 of file recall.hpp.
Referenced by apply_temp_modifier(), and remove_temp_modifier().
|
private |
Definition at line 91 of file recall.hpp.
Referenced by apply_temp_modifier(), and remove_temp_modifier().
|
private |
Definition at line 93 of file recall.hpp.
Referenced by apply_temp_modifier(), and remove_temp_modifier().
|
private |
Definition at line 88 of file recall.hpp.
Referenced by apply_temp_modifier(), check_validity(), draw_hex(), execute(), get_numbering_hex(), get_recall_hex(), init(), print(), redraw(), remove_temp_modifier(), and to_config().
|
private |
Definition at line 87 of file recall.hpp.
Referenced by apply_temp_modifier(), check_validity(), execute(), get_unit(), recall(), remove_temp_modifier(), and to_config().