[wesnoth-commits] [wesnoth/wesnoth] fd0c00: Goto Micro AI: fix checks of avoid_enemies key

mattsc noreply at github.com
Sun Feb 28 18:23:14 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: fd0c00cfb0cba8bd7b3afde90b806d6e505bd423
      https://github.com/wesnoth/wesnoth/commit/fd0c00cfb0cba8bd7b3afde90b806d6e505bd423
  Author: mattsc <mattsc000 at gmail.com>
  Date:   2021-02-28 (Sun, 28 Feb 2021)

  Changed paths:
    M data/ai/micro_ais/cas/ca_goto.lua

  Log Message:
  -----------
  Goto Micro AI: fix checks of avoid_enemies key

Numerical values are sometimes transferred from WML to Lua using the string type. This applies, for example, to very small numbers, such as 0.0000000000001. This needs to be taken into account when checking whether avoid_enemies is a number.


  Commit: 94bd2ec9936d60c1f5fa5681f832229247c95d5f
      https://github.com/wesnoth/wesnoth/commit/94bd2ec9936d60c1f5fa5681f832229247c95d5f
  Author: mattsc <mattsc000 at gmail.com>
  Date:   2021-02-28 (Sun, 28 Feb 2021)

  Changed paths:
    M data/ai/micro_ais/cas/ca_goto.lua

  Log Message:
  -----------
  Goto Micro AI: fix possible error when ignoring enemies

The final determination of the hex to move to must take enemies into account, otherwise the MAI might try to move the unit to a hex it cannot actually reach.


  Commit: 287530a43fa1d36a632afb5282f7145a59feb2e3
      https://github.com/wesnoth/wesnoth/commit/287530a43fa1d36a632afb5282f7145a59feb2e3
  Author: mattsc <mattsc000 at gmail.com>
  Date:   2021-02-28 (Sun, 28 Feb 2021)

  Changed paths:
    M data/ai/micro_ais/cas/ca_goto.lua

  Log Message:
  -----------
  Goto Micro AI: change how avoid_map is taken into account

There were two issues with the previous method:
- ai_helper.get_avoid_map() never returns nil, but at most an empty location set. Thus, the 'else' clause in that conditional was never reached.
- The presence of an [avoid] tag should not prevent the keys ignoring enemies from taking effect. Instead, [avoid] needs to be taken into account for all possible code paths.


Compare: https://github.com/wesnoth/wesnoth/compare/dff7b7d90da9...287530a43fa1



More information about the Commits mailing list