The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
formula_manager.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2016 by Chris Beck <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 
16 #ifndef UNIT_FORMULA_MANAGER_HPP
17 #define UNIT_FORMULA_MANAGER_HPP
18 
19 #include "formula/callable.hpp" //map_formula_callable_ptr is an intrusive ptr, requires full header to compile
20 
21 #include<string>
22 
23 class config;
24 struct map_location;
25 class unit;
26 
28 public:
34  formula_vars_(o.formula_vars_ ? new game_logic::map_formula_callable(*o.formula_vars_) : o.formula_vars_)
35  {}
36 
38  void add_formula_var(std::string str, variant var);
39  bool has_formula() const { return !unit_formula_.empty(); }
40  bool has_loop_formula() const { return !unit_loop_formula_.empty(); }
41  bool has_priority_formula() const { return !unit_priority_formula_.empty(); }
42  const std::string& get_formula() const { return unit_formula_; }
43  const std::string& get_loop_formula() const { return unit_loop_formula_; }
45 
46  void read(const config & ai);
47  void write(config & cfg);
48 
49 private:
54 };
55 
56 #endif
bool has_loop_formula() const
unit_formula_manager(const unit_formula_manager &o)
Definition: unit.hpp:95
void write(config &cfg)
const game_logic::map_formula_callable_ptr & formula_vars() const
const std::string & get_loop_formula() const
std::string unit_loop_formula_
const std::string & get_formula() const
std::string unit_priority_formula_
const std::string & get_priority_formula() const
A small explanation about what's going on here: Each action has access to two game_info objects First...
Definition: actions.cpp:57
void read(const config &ai)
game_logic::map_formula_callable_ptr formula_vars_
Encapsulates the map of the game.
Definition: location.hpp:38
bool has_priority_formula() const
bool has_formula() const
void add_formula_var(std::string str, variant var)
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
GLsizei const GLcharARB ** string
Definition: glew.h:4503