Added target callable obejct for attack moves

This commit is contained in:
Douglas Hains 2008-08-07 08:05:58 +00:00
parent faa2da5dd7
commit c7e7dde675
2 changed files with 5 additions and 0 deletions

View file

@ -1287,6 +1287,10 @@ void formula_ai::make_candidate_moves() {
callable.add_ref();
variant action_unit_callable(new unit_callable(*(*best_move)->get_action_unit()));
callable.add("me", action_unit_callable);
if((*best_move)->get_type() == "attack") {
variant enemy_unit_callable(new unit_callable(*(*best_move)->get_enemy_unit()));
callable.add("target", enemy_unit_callable);
}
const_formula_ptr move_formula((*best_move)->get_move());
make_move(move_formula, callable);
// And re-evaluate candidate moves

View file

@ -45,6 +45,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_;}
unit_map::unit_iterator get_enemy_unit() {return enemy_unit_;}
const_formula_ptr get_move() {return move_;}
struct move_compare {