42 return recruit->print(s);
47 return recruit->print(s);
113 const std::size_t old_id =
fake_unit_->underlying_id();
130 success = complete = result;
139 <<
"] at position " <<
temp_unit_->get_location() <<
".\n";
146 const size_t old_id =
temp_unit_->underlying_id();
150 assert(
temp_unit_->underlying_id() == old_id);
172 const double x_offset = 0.5;
173 const double y_offset = 0.7;
175 std::stringstream number_text;
180 number_text.str(),
font_size, color, x_offset, y_offset);
196 bool real_unit =
false;
198 result->set_movement(0,
true);
199 result->set_attacks(0);
211 if(recruits.find(
unit_name_) == recruits.end()) {
215 if (!in_extra_recruit) {
235 final_cfg[
"type"] =
"recruit";
242 final_cfg.
add_child(
"recruit_hex_", std::move(loc_cfg));
play_controller * controller
void reset()
Reset the internal unit pointer, and deregister from the manager.
Move numbering for the whiteboard.
static display * get_singleton()
Returns the display object if a display object exists.
const unit_type * find(const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const
Finds a unit_type by its id() and makes sure it is built to the specified level.
virtual const std::vector< team > & teams() const override
void invalidate_game_status()
Function to invalidate the game status displayed on the sidebar.
virtual error check_validity() const
Check the validity of the action.
virtual const unit_map & units() const override
std::shared_ptr< recruit const > recruit_const_ptr
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
This class represents a single unit of a specific type.
umap_retval_pair_t insert(unit_ptr p)
Inserts the unit pointed to by p into the map.
void place_on_fake_unit_manager(fake_unit_manager *d)
Place this on manager's fake_units_ dequeue.
unit * find_recruiter(std::size_t team_index, const map_location &hex)
virtual void visit(move_ptr move)=0
unit_type_data unit_types
virtual void execute(bool &success, bool &complete)
Output parameters: success: Whether or not to continue an execute-all after this execution complete: ...
virtual void apply_temp_modifier(unit_map &unit_map)
Applies temporarily the result of this action to the specified unit map.
bool do_recruit(const std::string &name, int side_num, map_location &target_hex)
virtual void do_hide()
Called by the non-virtual hide() and show(), respectively.
static config unit_name(const unit *u)
std::shared_ptr< unit > unit_ptr
static unit_ptr create(const config &cfg, bool use_traits=false, const vconfig *vcfg=nullptr)
Initializes a unit from a config.
A single unit type that the player may recruit.
std::size_t team_index() const
Returns the index of the team that owns this action.
virtual config to_config() const
Constructs and returns a config object representing this object.
bool valid()
Returns whether this action is valid or not.
const std::string unicode_minus
map_location const get_recruit_hex() const
std::shared_ptr< recruit > recruit_ptr
unit_ptr create_corresponding_unit()
fake_unit_manager * fake_units
void draw_text_in_hex(const map_location &loc, const drawing_layer layer, const std::string &text, std::size_t font_size, color_t color, double x_in_hex=0.5, double y_in_hex=0.5)
Draw text on a hex.
recruit(std::size_t team_index, bool hidden, const std::string &unit_name, const map_location &recruit_hex)
virtual void accept(visitor &v)
Encapsulates the map of the game.
unit_iterator find(std::size_t id)
std::shared_ptr< recruit > shared_from_this()
static map_location::DIRECTION s
virtual void redraw()
Redrawing function, called each time the action situation might have changed.
side_actions_ptr viewer_actions()
config & add_child(config_key_type key)
const std::vector< std::string > & recruits() const
The type IDs of the other units this unit may recruit, if possible.
virtual std::ostream & print(std::ostream &s) const
bool any_recruiter(int team_num, const map_location &loc, std::function< bool(unit &)> func)
executes func for each unti of side of side_num that can recruit on loc.
map_location recruit_hex_
events::menu_handler & get_menu_handler()
unit_ptr extract(const map_location &loc)
Extracts a unit from the map.
Container associating units to locations.
std::ostream & operator<<(std::ostream &s, action_ptr action)
virtual void draw_hex(const map_location &hex)
Gets called by display when drawing a hex, to allow actions to draw to the screen.
visitor is an abstract interface : action.accept(visitor) calls visitor.visit(action) ...
Abstract base class for all the whiteboard planned actions.
A config object defines a single node in a WML file, with access to child nodes.
virtual config to_config() const
Constructs and returns a config object representing this object.
virtual void remove_temp_modifier(unit_map &unit_map)
Removes the result of this action from the specified unit map.
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses...