#include <callable_objects.hpp>
Public Member Functions | |
attack_callable (const map_location &move_from, const map_location &src, const map_location &dst, int weapon) | |
const map_location & | move_from () const |
const map_location & | src () const |
const map_location & | dst () const |
int | weapon () const |
int | defender_weapon () const |
int | do_compare (const formula_callable *callable) const override |
Compare two attacks in deterministic way or compare pointers (nondeterministic in consequent game runs) if method argument is not attack_callable. More... | |
variant | execute_self (variant ctxt) override |
Public Member Functions inherited from wfl::formula_callable | |
formula_callable (bool has_self=true) | |
virtual | ~formula_callable () |
formula_callable_ptr | fake_ptr () |
const_formula_callable_ptr | fake_ptr () const |
variant | query_value (const std::string &key) const |
void | mutate_value (const std::string &key, const variant &value) |
formula_input_vector | inputs () const |
bool | equals (const formula_callable &other) const |
bool | less (const formula_callable &other) const |
bool | has_key (const std::string &key) const |
void | serialize (std::string &str) const |
void | subscribe_dtor (callable_die_subscriber *d) const |
void | unsubscribe_dtor (callable_die_subscriber *d) const |
Private Member Functions | |
variant | get_value (const std::string &key) const override |
void | get_inputs (formula_input_vector &inputs) const override |
Private Attributes | |
map_location | move_from_ |
map_location | src_ |
map_location | dst_ |
battle_context | bc_ |
Additional Inherited Members | |
Protected Types inherited from wfl::formula_callable | |
enum | TYPE { FORMULA_C , TERRAIN_C , LOCATION_C , UNIT_TYPE_C , UNIT_C , ATTACK_TYPE_C , MOVE_PARTIAL_C , MOVE_C , ATTACK_C , MOVE_MAP_C } |
Protected Member Functions inherited from wfl::formula_callable | |
virtual void | set_value (const std::string &key, const variant &) |
virtual void | serialize_to_string (std::string &) const |
Static Protected Member Functions inherited from wfl::formula_callable | |
template<typename T , typename K > | |
static variant | convert_map (const std::map< T, K > &input_map) |
template<typename T > | |
static variant | convert_set (const std::set< T > &input_set) |
template<typename T > | |
static variant | convert_vector (const std::vector< T > &input_vector) |
static void | add_input (formula_input_vector &inputs, const std::string &key, formula_access access_type=formula_access::read_only) |
Protected Attributes inherited from wfl::formula_callable | |
TYPE | type_ |
std::set< callable_die_subscriber * > | dtor_notify |
Definition at line 47 of file callable_objects.hpp.
wfl::attack_callable::attack_callable | ( | const map_location & | move_from, |
const map_location & | src, | ||
const map_location & | dst, | ||
int | weapon | ||
) |
Definition at line 160 of file callable_objects.cpp.
References wfl::formula_callable::ATTACK_C, and wfl::formula_callable::type_.
|
inline |
Definition at line 61 of file callable_objects.hpp.
References battle_context_unit_stats::attack_num, bc_, and battle_context::get_defender_stats().
Referenced by do_compare().
|
overridevirtual |
Compare two attacks in deterministic way or compare pointers (nondeterministic in consequent game runs) if method argument is not attack_callable.
Reimplemented from wfl::formula_callable.
Definition at line 187 of file callable_objects.cpp.
References defender_weapon(), wfl::formula_callable::do_compare(), map_location::do_compare(), dst(), dst_, move_from(), move_from_, src(), src_, and weapon().
|
inline |
Implements wfl::action_callable.
Definition at line 215 of file callable_objects.cpp.
References wfl::variant::as_callable(), dst_, wfl::formula_callable::fake_ptr(), ai::get_ai_context(), ai::action_result::get_status(), ai::move_result::get_unit_location(), ai::action_result::is_gamestate_changed(), ai::action_result::is_ok(), LOG_AI, move_from_, src_, and weapon().
|
overrideprivatevirtual |
Reimplemented from wfl::formula_callable.
Definition at line 181 of file callable_objects.cpp.
References wfl::formula_callable::add_input(), and wfl::formula_callable::inputs().
|
overrideprivatevirtual |
Implements wfl::formula_callable.
Definition at line 169 of file callable_objects.cpp.
References dst_, move_from_, and src_.
|
inline |
Definition at line 57 of file callable_objects.hpp.
References move_from_.
Referenced by do_compare().
|
inline |
|
inline |
Definition at line 60 of file callable_objects.hpp.
References battle_context_unit_stats::attack_num, bc_, and battle_context::get_attacker_stats().
Referenced by do_compare(), and execute_self().
|
private |
Definition at line 49 of file callable_objects.hpp.
Referenced by defender_weapon(), and weapon().
|
private |
Definition at line 48 of file callable_objects.hpp.
Referenced by do_compare(), dst(), execute_self(), and get_value().
|
private |
Definition at line 48 of file callable_objects.hpp.
Referenced by do_compare(), execute_self(), get_value(), and move_from().
|
private |
Definition at line 48 of file callable_objects.hpp.
Referenced by do_compare(), execute_self(), get_value(), and src().