16 #ifndef CALLABLE_OBJECTS_HPP_INCLUDED
17 #define CALLABLE_OBJECTS_HPP_INCLUDED
24 #define CALLABLE_WRAPPER_START(klass) \
25 class klass##_callable : public game_logic::formula_callable { \
26 const klass& object_; \
28 explicit klass##_callable(const klass& object) : object_(object) \
31 const klass& get_##klass() const { return object_; } \
32 void get_inputs(std::vector<game_logic::formula_input>* inputs) const \
34 using game_logic::FORMULA_READ_ONLY;
36 #define CALLABLE_WRAPPER_INPUT(VAR) \
37 inputs->push_back(game_logic::formula_input(#VAR, FORMULA_READ_ONLY));
39 #define CALLABLE_WRAPPER_INPUT_END \
42 variant get_value(const std::string& key) const {
44 #define CALLABLE_WRAPPER_VAR(VAR) \
46 return variant(object_.VAR); \
49 #define CALLABLE_WRAPPER_FN2(VAR, FN) \
51 return variant(object_.FN()); \
54 #define CALLABLE_WRAPPER_FN(VAR) CALLABLE_WRAPPER_FN2(VAR, VAR)
56 #define CALLABLE_WRAPPER_END \
57 { return variant(); } \
92 std::vector<variant> vars;
93 for(
int i = 0;
i <
w;
i++) {
94 for(
int j = 0;j <
h; j++) {
110 void get_inputs(std::vector<game_logic::formula_input>* inputs)
const;
235 if(key == "start_gold") {
236 return variant(lexical_cast<int>(object_.start_gold()));
257 if(key == "recruit") {
258 const std::set<std::string>& recruits = object_.recruits();
259 std::vector<variant>
result;
260 for(std::set<std::string>::const_iterator it = recruits.begin(); it != recruits.end(); ++it) {
261 result.push_back(
variant(*it));
264 }
else if(key ==
"wml_vars") {
variant get_value(const std::string &key) const
location_callable(int x, int y)
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
int do_compare(const formula_callable *callable) const
unit_callable(const location &loc, const unit &u)
variant get_value(const std::string &key) const
int do_compare(const formula_callable *callable) const
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
const map_location & loc() const
variant get_value(const std::string &key) const
GLint GLint GLint GLint GLint GLint y
const unit & get_unit() const
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
This class stores all the data for a single 'side' (in game nomenclature).
config_callable(const config &c)
GLubyte GLubyte GLubyte GLubyte w
const unit_type & get_unit_type() const
const attack_type & get_attack_type() const
variant get_value(const std::string &key) const
Encapsulates the map of the game.
variant get_value(const std::string &key) const
static const ::config * terrain
The terrain used to create the cache.
Encapsulates the map of the game.
const config & get_config() const
const location & get_location() const
unit_type_callable(const unit_type &u)
GLfloat GLfloat GLfloat GLfloat h
GLint GLint GLint GLint GLint x
int do_compare(const formula_callable *callable) const
attack_type_callable(const attack_type &attack)
GLuint const GLchar * name
location_callable(const map_location &loc)
void get_inputs(std::vector< game_logic::formula_input > *inputs) const
int do_compare(const formula_callable *callable) 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
GLsizei const GLcharARB ** string
unit_callable(const unit &u)
terrain_callable(const terrain_type &t, const location &loc)
int do_compare(const formula_callable *callable) const