mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-01 18:38:37 +00:00
Pull type information for candidate moves from WML...
...and added type member to candidate move class
This commit is contained in:
parent
f60398313e
commit
f278afcc72
@ -1155,10 +1155,10 @@ expression_ptr ai_function_symbol_table::create_function(const std::string &fn,
|
||||
}
|
||||
|
||||
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 @@ formula_ai::formula_ai(info& i) :
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,9 @@ namespace game_logic {
|
||||
|
||||
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 @@ public:
|
||||
}
|
||||
|
||||
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 @@ public:
|
||||
private:
|
||||
|
||||
std::string name_;
|
||||
std::string type_;
|
||||
const_formula_ptr eval_;
|
||||
const_formula_ptr move_;
|
||||
int score_;
|
||||
@ -90,7 +93,7 @@ public:
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user