40 return lexical_cast_default<T>(cfg[
"value"]);
50 cfg[
"value"] = lexical_cast<std::string>(value);
67 return cfg[
"value"].str();
95 return cfg[
"value"].to_bool();
105 cfg[
"value"] = value;
117 #ifdef USING_BOOST_VARIANT
118 :
public boost::static_visitor<std::string>
138 if (cfg[
"value"].to_bool(
true) == cfg[
"value"].to_bool(
false)) {
139 return cfg[
"value"].to_bool();
240 cfg.
add_child(
"value",value.to_config());
408 std::vector<wfl::variant> vars;
409 for(attacks_vector::const_iterator
i = value.begin();
i != value.end(); ++
i) {
410 vars.emplace_back(std::make_shared<attack_analysis>(*
i));
Managing the AIs lifecycle - headers TODO: Refactor history handling and internal commands.
static bool cfg_to_value(const config &cfg)
static void value_to_cfg(const bool &value, config &cfg)
static config value_to_cfg(const bool &value)
static void cfg_to_value(const config &cfg, bool &value)
static config value_to_cfg(const config &value)
static config cfg_to_value(const config &cfg)
static void value_to_cfg(const config &value, config &cfg)
static void cfg_to_value(const config &cfg, config &value)
static config value_to_cfg(const std::string &value)
static void cfg_to_value(const config &cfg, std::string &value)
static void value_to_cfg(const std::string &value, config &cfg)
static std::string cfg_to_value(const config &cfg)
static config value_to_cfg(const std::vector< std::string > &value)
static std::vector< std::string > cfg_to_value(const config &cfg)
static void cfg_to_value(const config &cfg, std::vector< std::string > &value)
static void value_to_cfg(const std::vector< std::string > &value, config &cfg)
static void cfg_to_value(const config &cfg, terrain_filter &value)
static terrain_filter cfg_to_value(const config &cfg)
static config value_to_cfg(const terrain_filter &value)
static void value_to_cfg(const terrain_filter &value, config &cfg)
static unit_advancements_aspect cfg_to_value(const config &cfg)
static config value_to_cfg(const unit_advancements_aspect &value)
static void value_to_cfg(const unit_advancements_aspect &value, config &cfg)
static void cfg_to_value(const config &cfg, unit_advancements_aspect &value)
static utils::variant< bool, std::vector< std::string > > cfg_to_value(const config &cfg)
static void value_to_cfg(const utils::variant< bool, std::vector< std::string >> &value, config &cfg)
static void cfg_to_value(const config &cfg, utils::variant< bool, std::vector< std::string >> &value)
static config value_to_cfg(const utils::variant< bool, std::vector< std::string >> &value)
static T cfg_to_value(const config &cfg)
static config value_to_cfg(const T &value)
static void value_to_cfg(const T &value, config &cfg)
static void cfg_to_value(const config &cfg, T &value)
std::string operator()(const std::vector< std::string > s) const
std::string operator()(const bool b) const
const std::string get_value() const
static void variant_to_value(const wfl::variant &, attacks_vector &)
static void value_to_variant(const attacks_vector &value, wfl::variant &var)
static attacks_vector variant_to_value(const wfl::variant &var)
static wfl::variant value_to_variant(const attacks_vector &value)
static void variant_to_value(const wfl::variant &var, bool &value)
static wfl::variant value_to_variant(const bool &value)
static bool variant_to_value(const wfl::variant &var)
static void value_to_variant(const bool &value, wfl::variant &var)
static wfl::variant value_to_variant(const int &value)
static int variant_to_value(const wfl::variant &var)
static void variant_to_value(const wfl::variant &var, int &value)
static void value_to_variant(const int &value, wfl::variant &var)
static wfl::variant value_to_variant(const std::string &value)
static void value_to_variant(const std::string &value, wfl::variant &var)
static void variant_to_value(const wfl::variant &var, std::string &value)
static std::string variant_to_value(const wfl::variant &var)
static void variant_to_value(const wfl::variant &, terrain_filter &)
static wfl::variant value_to_variant(const terrain_filter &value)
static terrain_filter variant_to_value(const wfl::variant &var)
static void value_to_variant(const terrain_filter &, wfl::variant &)
static void value_to_variant(const T &, wfl::variant &)
static T variant_to_value(const wfl::variant &var)
static void variant_to_value(const wfl::variant &, T &)
static wfl::variant value_to_variant(const T &value)
A config object defines a single node in a WML file, with access to child nodes.
const config & child_or_empty(config_key_type key) const
Returns the first child with the given key, or an empty config if there is none.
optional_config_impl< config > optional_child(config_key_type key, int n=0)
Equivalent to mandatory_child, but returns an empty optional if the nth child was not found.
config & add_child(config_key_type key)
A variable-expanding proxy for the config class.
const std::string & as_string() const
bool as_bool() const
Returns a boolean state of the variant value.
AI Support engine - creating specific ai components from config.
New lexcical_cast header.
A small explanation about what's going on here: Each action has access to two game_info objects First...
std::vector< attack_analysis > attacks_vector
filter_context * filter_con
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
std::vector< std::string > split(const config_attribute_value &val)
static map_location::direction s
MacOS doesn't support std::visit when targing MacOS < 10.14 (currently we target 10....