54 final_cfg[
"type"]=
"action";
55 final_cfg[
"team_index_"]=
static_cast<int>(
team_index_);
62 std::string
type = cfg[
"type"];
66 return std::make_shared<move>(cfg,
hidden);
67 else if(
type ==
"attack")
68 return std::make_shared<attack>(cfg,
hidden);
69 else if(
type ==
"recruit")
70 return std::make_shared<recruit>(cfg,
hidden);
71 else if(
type ==
"recall")
72 return std::make_shared<recall>(cfg,
hidden);
73 else if(
type ==
"suppose_dead")
74 return std::make_shared<suppose_dead>(cfg,
hidden);
98 : team_index_(team_index)
108 int team_index_temp = cfg[
"team_index_"].to_int(-1);
109 if(team_index_temp < 0
111 throw ctor_err(
"action: Invalid team_index_");
122 return ret ? ret->underlying_id() : 0;
A config object defines a single node in a WML file, with access to child nodes.
Abstract base class for all the whiteboard planned actions.
virtual unit_ptr get_unit() const =0
Return the unit targeted by this action.
void hide()
Sets whether or not the action should be drawn on the screen.
virtual void do_hide()
Called by the non-virtual hide() and show(), respectively.
static action_ptr from_config(const config &, bool hidden)
Constructs an object of a subclass of wb::action using a config.
action(std::size_t team_index, bool hidden)
virtual std::size_t get_unit_id() const
Returns the id of the unit targeted by this action.
virtual std::ostream & print(std::ostream &s) const =0
virtual config to_config() const
Constructs and returns a config object representing this object.
Definitions for the interface to Wesnoth Markup Language (WML).
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
std::ostream & operator<<(std::ostream &s, action_ptr action)
std::shared_ptr< action > action_ptr
std::shared_ptr< action const > action_const_ptr
std::shared_ptr< unit > unit_ptr
static map_location::direction s