Update of bug #13317 (project wesnoth):

             Assigned to:                    None => dragonking             

    _______________________________________________________

Follow-up Comment #2:

Assigning to Dragonking.

the interesting code is:
===
std::string formula_ai::evaluate(const std::string& formula_str)
{
        try{
                move_maps_valid_ = false;

                game_logic::formula f(formula_str, &function_table);

                game_logic::map_formula_callable callable(this);
                callable.add_ref();

                const variant v = f.execute(callable);

                if ( execute_variant(v, true ) )
                        return "Made move: " + v.to_debug_string();

                return v.to_debug_string();
        }
        catch(formula_error& e) {
                e.line = 0;
                handle_exception(e);
                throw;
        }
}
==
'const variant v = f.execute(callable);' returns a good list of attack
evaluations, and 'execute_variant(v, true )' does an attack for each of those
evaluations. So, the problem is caused by .fai dynamic typing -  vector of
ai::attack_analysis is considered a vector of attack orders, therefore them
are executed. Since 'attacks' are documented as a list of possible attacks,
attacks must return something that will not be interpreted as an attack
order.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?13317>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to