URL:
  <http://gna.org/bugs/?21294>

                 Summary: undocumented "backwards compatability" code silently
strips out custom ais
                 Project: Battle for Wesnoth
            Submitted by: involution
            Submitted on: Sat 23 Nov 2013 03:06:22 PM GMT
                Category: Bug
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Artificial Intelligence
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.11.7
        Operating System: linux

    _______________________________________________________

Details:

>From /src/ai/configuration.cpp:

The function configuration::parse_side_config, which converts config
structures to ais, currently runs a check for an ai parameter "version". If
version.to_int() < 10703, then it runs the following function which strips out
any custom ai config info, replacing with idle_ai or default_rca_ai.

This is quite counter intuitive as the wiki for AIwml does not document the
"version" field anywhere, and also version is not parsed properly. I should be
able to type "version=1.11.7" in my ai-cfg files to ensure that they are
protected against this, but that doesn't work (leads to version.to_int() = 1),
and I must type "version=11107" in my ai configs instead.

I think that at the least a note should be put on the wiki about the version
flag and what it does, but ideally configuration.cpp could be made to parse
version strings correctly. This is quite a pain for anyone who tries to make a
custom ai in C++, I had to read most of /src/ai before I figured out what was
going on.

bool configuration::upgrade_side_config_from_1_07_02_to_1_07_03(side_number
side, config &cfg)
{
        LOG_AI_CONFIGURATION << "side "<< side <<": upgrading ai config version 
from
version 1.7.2 to 1.7.3"<< std::endl;
        config parsed_cfg;

        bool is_idle_ai = false;
        if (cfg["ai_algorithm"]=="idle_ai") {
                is_idle_ai = true;
        } else {
                BOOST_FOREACH(config &aiparam, cfg.child_range("ai")) {
                        if (aiparam["ai_algorithm"]=="idle_ai") {
                                is_idle_ai = true;
                                break;
                        }
                }
        }

        if (!is_idle_ai) {
                parsed_cfg = get_ai_config_for("ai_default_rca");
        }
        ...
}






    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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