37 return action->print(s);
43 return action->print(s);
54 final_cfg[
"type"]=
"action";
55 final_cfg[
"team_index_"]=
static_cast<int>(
team_index_);
62 std::string
type = cfg[
"type"];
67 else if(type==
"attack")
69 else if(type==
"recruit")
71 else if(type==
"recall")
73 else if(type==
"suppose_dead")
107 int team_index_temp = cfg[
"team_index_"].to_int(-1);
108 if(team_index_temp < 0
110 throw ctor_err(
"action: Invalid team_index_");
121 return ret ? ret->underlying_id() : 0;
static action_ptr from_config(const config &, bool hidden)
Constructs an object of a subclass of wb::action using a config.
Definitions for the interface to Wesnoth Markup Language (WML).
std::shared_ptr< unit > unit_ptr
std::size_t team_index() const
Returns the index of the team that owns this action.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
action(std::size_t team_index, bool hidden)
std::shared_ptr< action > action_ptr
virtual std::ostream & print(std::ostream &s) const =0
virtual unit_ptr get_unit() const =0
Return the unit targeted by this action.
virtual std::size_t get_unit_id() const
Returns the id of the unit targeted by this action.
static map_location::DIRECTION s
void hide()
Sets whether or not the action should be drawn on the screen.
std::ostream & operator<<(std::ostream &s, action_ptr 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.
A planned move, represented on the map by an arrow and a ghosted unit in the destination hex...
A planned action that temporarily removes a unit from the map for planning purposes.
virtual void do_hide()
Called by the non-virtual hide() and show(), respectively.
std::shared_ptr< action const > action_const_ptr