15 #include "formula/callable_objects.hpp"
21 template <
typename T,
typename K>
23 std::map<variant,variant> tmp;
25 for(
typename std::map< T, K>::const_iterator
i = input_map.begin();
i != input_map.end(); ++
i) {
36 std::vector<variant> tmp;
38 for(
typename std::vector<T>::const_iterator
i = input_vector.begin();
i != input_vector.end(); ++
i) {
50 }
else if(key ==
"y") {
67 if(loc_callable ==
nullptr) {
68 return formula_callable::do_compare(callable);
78 s <<
"loc(" << (
loc_.
x+1) <<
"," << (
loc_.
y+1) <<
")";
85 if(key ==
"id" || key ==
"name") {
87 }
else if(key ==
"description") {
89 }
else if(key ==
"type") {
91 }
else if(key ==
"icon") {
93 }
else if(key ==
"range") {
95 }
else if(key ==
"damage") {
97 }
else if(key ==
"number_of_attacks" || key ==
"number" || key ==
"num_attacks" || key ==
"attacks") {
99 }
else if(key ==
"attack_weight") {
101 }
else if(key ==
"defense_weight") {
103 }
else if(key ==
"accuracy") {
105 }
else if(key ==
"parry") {
107 }
else if(key ==
"movement_used") {
109 }
else if(key ==
"specials" || key ==
"special") {
111 std::vector<variant>
res;
114 if(!special.cfg[
"id"].empty()) {
115 res.push_back(
variant(special.cfg[
"id"].str()));
145 if(att_callable ==
nullptr) {
146 return formula_callable::do_compare(callable);
175 }
else if(key ==
"y") {
181 }
else if(key ==
"loc") {
187 }
else if(key ==
"id") {
189 }
else if(key ==
"type") {
191 }
else if(key ==
"name") {
193 }
else if(key ==
"usage") {
195 }
else if(key ==
"leader" || key ==
"canrecruit") {
197 }
else if(key ==
"undead") {
199 }
else if(key ==
"attacks") {
200 const std::vector<attack_type>& att =
u_.
attacks();
201 std::vector<variant>
res;
203 for( std::vector<attack_type>::const_iterator
i = att.begin();
i != att.end(); ++
i)
206 }
else if(key ==
"abilities") {
208 std::vector<variant>
res;
210 if (abilities.empty())
218 }
else if(key ==
"hitpoints") {
220 }
else if(key ==
"max_hitpoints") {
222 }
else if(key ==
"experience") {
224 }
else if(key ==
"max_experience") {
226 }
else if(key ==
"level" || key ==
"full") {
229 }
else if(key ==
"total_movement" || key ==
"max_moves") {
231 }
else if(key ==
"movement_left" || key ==
"moves") {
233 }
else if(key ==
"attacks_left") {
235 }
else if(key ==
"max_attacks") {
237 }
else if(key ==
"traits") {
239 std::vector<variant>
res;
244 for (std::vector<std::string>::const_iterator it = traits.begin(); it != traits.end(); ++it)
249 }
else if(key ==
"extra_recruit") {
250 const std::vector<std::string> recruits =
u_.
recruits();
251 std::vector<variant>
res;
256 for (std::vector<std::string>::const_iterator it = recruits.begin(); it != recruits.end(); ++it)
261 }
else if(key ==
"advances_to") {
263 std::vector<variant>
res;
268 for (std::vector<std::string>::const_iterator it = advances.begin(); it != advances.end(); ++it)
273 }
else if(key ==
"states" || key ==
"status") {
274 const std::map<std::string, std::string>& states_map =
u_.
get_states();
277 }
else if(key ==
"side") {
279 }
else if(key ==
"cost") {
281 }
else if(key ==
"upkeep") {
283 }
else if(key ==
"loyal") {
286 }
else if(key ==
"hidden") {
288 }
else if(key ==
"petrified") {
290 }
else if(key ==
"resting") {
292 }
else if(key ==
"role") {
294 }
else if(key ==
"race") {
296 }
else if(key ==
"gender") {
298 }
else if(key ==
"variation") {
300 }
else if(key ==
"zoc") {
302 }
else if(key ==
"alignment") {
304 }
else if(key ==
"facing") {
306 }
else if(key ==
"vars") {
312 }
else if(key ==
"wml_vars") {
314 }
else if(key ==
"n" || key ==
"s" || key ==
"ne" || key ==
"se" || key ==
"nw" || key ==
"sw" || key ==
"lawful" || key ==
"neutral" || key ==
"chaotic" || key ==
"liminal" || key ==
"male" || key ==
"female") {
368 if(u_callable ==
nullptr) {
369 return formula_callable::do_compare(callable);
379 }
else if(key ==
"type") {
381 }
else if(key ==
"alignment") {
382 return variant(
u_.alignment().to_string());
383 }
else if(key ==
"race") {
385 }
else if(key ==
"abilities") {
387 std::vector<variant>
res;
389 if (abilities.empty())
397 }
else if(key ==
"traits") {
398 std::vector<variant>
res;
405 }
else if(key ==
"attacks") {
406 std::vector<attack_type> att =
u_.
attacks();
407 std::vector<variant>
res;
412 }
else if(key ==
"hitpoints" || key ==
"max_hitpoints") {
414 }
else if(key ==
"experience" || key ==
"max_experience") {
416 }
else if(key ==
"level") {
418 }
else if(key ==
"total_movement" || key ==
"max_moves" || key ==
"moves") {
420 }
else if(key ==
"unpoisonable") {
422 }
else if(key ==
"undrainable") {
424 }
else if(key ==
"unplagueable") {
426 }
else if(key ==
"cost") {
428 }
else if(key ==
"recall_cost") {
430 }
else if(key ==
"usage") {
460 if(u_callable ==
nullptr) {
461 return formula_callable::do_compare(callable);
464 return u_.
id().compare(u_callable->
u_.
id());
483 std::vector<variant>
result;
488 }
else if(key ==
"__all_children") {
489 std::vector<variant>
result;
493 result.push_back(kv);
496 }
else if(key ==
"__children") {
497 std::map<std::string, std::vector<variant> >
build;
500 build[child.key].push_back(cfg_child);
502 std::map<variant,variant>
result;
503 for(
auto&
p : build) {
507 }
else if(key ==
"__attributes") {
508 std::map<variant,variant>
result;
531 if(cfg_callable ==
nullptr) {
532 return formula_callable::do_compare(callable);
545 }
else if(key ==
"y") {
547 }
else if(key ==
"loc") {
549 }
else if(key ==
"id") {
551 }
else if(key ==
"name") {
553 }
else if(key ==
"editor_name") {
555 }
else if(key ==
"description") {
557 }
else if(key ==
"icon") {
559 }
else if(key ==
"light") {
561 }
else if(key ==
"village") {
563 }
else if(key ==
"castle") {
565 }
else if(key ==
"keep") {
567 }
else if(key ==
"healing") {
594 if(terr_callable ==
nullptr) {
595 return formula_callable::do_compare(callable);
const t_string & name() const
variant get_value(const std::string &key) const
child_itors child_range(const std::string &key)
int total_movement() const
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
const std::string & id() const
std::string const & gender_string(unit_race::GENDER gender)
const t_string & type_name() const
The name of the unit in the current language setting.
int max_hitpoints() const
bool get_state(const std::string &state) const
size_t underlying_id() const
The unique internal ID of the unit.
const t_string & name() const
The unit name for display.
twindow * build(CVideo &video, const twindow_builder::tresolution *definition)
Builds a window.
double attack_weight() const
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
variant get_value(const std::string &key) const
int do_compare(const formula_callable *callable) const
bool musthave_status(const std::string &status) const
variant operator()(unsigned long long i) const
variant get_value(const std::string &key) const
int do_compare(const formula_callable *callable) const
int movement_used() const
std::string usage() const
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
variant operator()(const t_string &s) const
std::vector< std::string > get_ability_list() const
const std::string & id() const
const map_location & loc() const
GLuint const GLfloat * val
const t_string & name() const
const std::string & id() const
variant get_value(const std::string &key) const
int light_bonus(int base) const
Returns the light (lawful) bonus for this terrain when the time of day gives a base bonus...
int do_compare(const game_logic::formula_callable *callable) const
std::string weapon_specials(bool only_active=false, bool is_backstab=false) const
Returns a comma-separated string of active names for the specials of *this.
const std::string & icon() const
Definitions for the interface to Wesnoth Markup Language (WML).
const t_string & editor_name() const
void serialize_to_string(std::string &str) const
const std::vector< std::string > & recruits() const
GLdouble GLdouble GLdouble b
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
bool has_child(const std::string &key) const
Determine whether a config has a child or not.
const std::string & type_id() const
The id of the type of the unit.
bool incapacitated() const
config_callable(const config &c)
int gives_healing() const
unit_type::ALIGNMENT alignment() const
all_children_itors all_children_range() const
In-order iteration over all children.
variant operator()(const std::string &s) const
variant get_value(const std::string &key) const
unit_race::GENDER gender() const
variant operator()(int i) const
variant get_value(const std::string &key) const
static const map_location & null_location()
const config specials() const
int movement_left() const
Returns how far a unit can move this turn (zero if incapacitated).
variant operator()(boost::blank) const
const std::string & id() const
const std::string & type() const
const std::vector< attack_type > & attacks() const
std::string race_id() const
Returns the ID of this type's race without the need to build the type.
Encapsulates the map of the game.
const std::string & usage() const
const config & get_config() const
const std::vector< std::string > & advances_to() const
map_location::DIRECTION facing() const
const std::map< std::string, std::string > get_states() const
config::const_child_itors possible_traits() const
const_attr_itors attribute_range() const
const std::string & range() const
const std::string & variation() const
int do_compare(const formula_callable *callable) const
int experience_needed(bool with_acceleration=true) const
variant operator()(double i) const
unit_formula_manager & formula_manager() const
bool has_attribute(const std::string &key) const
int max_experience() const
std::vector< attack_type > attacks() const
int do_compare(const map_location &a) const
three-way comparator
double defense_weight() const
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
int do_compare(const formula_callable *callable) const
const std::string & str() const
variant operator()(bool b) const
const std::string & get_role() const
bool get_emit_zoc() const
A config object defines a single node in a WML file, with access to child nodes.
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
const t_string & description() const
const unit_race * race() const
Never returns nullptr, but may point to the null race.
static std::string write_direction(DIRECTION dir)
std::vector< std::string > get_ability_list() const
GLsizei const GLcharARB ** string
const std::string & icon_image() const
const std::string & id() const
The id for this unit_type.
int do_compare(const formula_callable *callable) const
std::vector< std::string > get_traits_list() const