mail[Wesnoth-commits] r28340 - in /trunk/src: formula_ai.cpp formula_ai.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by dhains on August 06, 2008 - 06:59:
Author: dhains
Date: Wed Aug  6 06:58:58 2008
New Revision: 28340

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28340&view=rev
Log:
Pull type information for candidate moves from WML and added type member to 
candidate move class

Modified:
    trunk/src/formula_ai.cpp
    trunk/src/formula_ai.hpp

Modified: trunk/src/formula_ai.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formula_ai.cpp?rev=28340&r1=28339&r2=28340&view=diff
==============================================================================
--- trunk/src/formula_ai.cpp (original)
+++ trunk/src/formula_ai.cpp Wed Aug  6 06:58:58 2008
@@ -1155,10 +1155,10 @@
 }
 
 void ai_function_symbol_table::register_candidate_move(const std::string 
name, 
-               const_formula_ptr formula, const_formula_ptr eval, 
+               const std::string type, const_formula_ptr formula, 
const_formula_ptr eval, 
                const_formula_ptr precondition, const 
std::vector<std::string>& args)
 {
-       candidate_move_ptr new_move(new candidate_move(name,eval,formula));
+       candidate_move_ptr new_move(new 
candidate_move(name,type,eval,formula));
        candidate_moves.push_back(new_move);
        function_symbol_table::add_formula_function(name, formula, 
                        precondition, args);
@@ -1211,7 +1211,8 @@
                const formula_ptr precondition_formula = 
                                
game_logic::formula::create_optional_formula((**i)["precondition"], 
                                                &function_table);
-               function_table.register_candidate_move(name, action_formula, 
eval_formula, 
+               function_table.register_candidate_move(name, (**i)["type"],
+                                                               
action_formula, eval_formula, 
                                                                
precondition_formula, args);
        }
 

Modified: trunk/src/formula_ai.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formula_ai.hpp?rev=28340&r1=28339&r2=28340&view=diff
==============================================================================
--- trunk/src/formula_ai.hpp (original)
+++ trunk/src/formula_ai.hpp Wed Aug  6 06:58:58 2008
@@ -30,8 +30,9 @@
 
 class candidate_move {
 public:
-       candidate_move(std::string name, const_formula_ptr eval, 
const_formula_ptr move) :
+       candidate_move(std::string name, std::string type, const_formula_ptr 
eval, const_formula_ptr move) :
                name_(name),
+               type_(type),
                eval_(eval),
                move_(move),
                score_(-1),
@@ -57,6 +58,7 @@
        }
 
        int get_score() const {return score_;}
+       std::string get_type() const {return type_;}
        unit_map::unit_iterator get_action_unit() {return action_unit_;}
        const_formula_ptr get_move() {return move_;}
 
@@ -71,6 +73,7 @@
 private:
 
        std::string name_;
+       std::string type_;
        const_formula_ptr eval_;
        const_formula_ptr move_;
        int score_;
@@ -90,7 +93,7 @@
                candidate_moves()
        {}
 
-       void register_candidate_move(const std::string name, 
+       void register_candidate_move(const std::string name, const 
std::string type,
                        const_formula_ptr formula, const_formula_ptr eval, 
                        const_formula_ptr precondition, const 
std::vector<std::string>& args);
 




Related Messages


Powered by MHonArc, Updated Wed Aug 06 16:21:15 2008