59 :
action(team_index,hidden)
60 , temp_unit_(u.clone())
61 , recall_hex_(recall_hex)
62 , fake_unit_(u.clone())
65 , original_recall_pos_(0)
73 , recall_hex_(cfg.mandatory_child(
"recall_hex_")[
"x"],cfg.mandatory_child(
"recall_hex_")[
"y"],
wml_loc())
77 , original_recall_pos_(0)
80 std::size_t underlying_id = cfg[
"temp_unit_"].to_size_t();
135 success = complete = result;
144 <<
"] at position " <<
temp_unit_->get_location() <<
".";
161 if (it->recall_cost() > -1) {
162 cost = it->recall_cost();
192 const double x_offset = 0.5;
193 const double y_offset = 0.7;
195 std::stringstream number_text;
204 std::size_t font_size = 16;
207 number_text.str(), font_size, color, x_offset, y_offset);
248 final_cfg[
"type"] =
"recall";
249 final_cfg[
"temp_unit_"] =
static_cast<int>(
temp_unit_->underlying_id());
255 final_cfg.
add_child(
"recall_hex_", std::move(loc_cfg));
A config object defines a single node in a WML file, with access to child nodes.
config & add_child(config_key_type key)
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.
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
void invalidate_game_status()
Function to invalidate the game status displayed on the sidebar.
static display * get_singleton()
Returns the display object if a display object exists.
void reset()
Reset the internal unit pointer, and deregister from the manager.
void place_on_fake_unit_manager(fake_unit_manager *d)
Place this on manager's fake_units_ dequeue.
virtual const std::vector< team > & teams() const override
static config get_recall(const std::string &unit_id, const map_location &loc, const map_location &from)
static bool run_and_throw(const std::string &commandname, const config &data, action_spectator &spectator=get_default_spectator())
This class stores all the data for a single 'side' (in game nomenclature).
std::shared_ptr< wb::side_actions > get_side_actions() const
get the whiteboard planned actions for this team
Container associating units to locations.
unit_ptr extract(const map_location &loc)
Extracts a unit from the map.
umap_retval_pair_t insert(unit_ptr p)
Inserts the unit pointed to by p into the map.
This class represents a single unit of a specific type.
A variable-expanding proxy for the config class.
Abstract base class for all the whiteboard planned actions.
bool valid()
Returns whether this action is valid or not.
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.
std::shared_ptr< recall > shared_from_this()
virtual void remove_temp_modifier(unit_map &unit_map)
Removes the result of this action from the specified unit map.
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.
virtual void do_hide()
Called by the non-virtual hide() and show(), respectively.
virtual void redraw()
Redrawing function, called each time the action situation might have changed.
virtual std::ostream & print(std::ostream &s) const
virtual error check_validity() const
Check the validity of the action.
map_location const get_recall_hex() const
recall(std::size_t team_index, bool hidden, const unit &unit, const map_location &recall_hex)
virtual void draw_hex(const map_location &hex)
Gets called by display when drawing a hex, to allow actions to draw to the screen.
virtual unit_ptr get_unit() const
virtual void accept(visitor &v)
virtual config to_config() const
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses.
virtual void visit(move_ptr move)=0
map_display and display: classes which take care of displaying the map and game-data on the screen.
@ actions_numbering
Move numbering for the whiteboard.
const config & recall_filter() const
Gets the filter constraints upon which units this unit may recall, if able.
int recall_cost() const
How much gold it costs to recall this unit, or -1 if the side's default recall cost is used.
bool recall_unit(const std::string &id, team ¤t_team, const map_location &loc, const map_location &from, map_location::direction facing)
Recalls the unit with the indicated ID for the provided team.
const std::string unicode_minus
fake_unit_manager * fake_units
static std::string at(const std::string &file, int line)
std::shared_ptr< recall const > recall_const_ptr
std::ostream & operator<<(std::ostream &s, action_ptr action)
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.
std::shared_ptr< recall > recall_ptr
std::shared_ptr< unit > unit_ptr
The basic class for representing 8-bit RGB or RGBA colour values.
Encapsulates the map of the game.
static const map_location & null_location()
static map_location::direction s
visitor is an abstract interface : action.accept(visitor) calls visitor.visit(action)