[Commits] [wesnoth/wesnoth] e7bd4b: Default AI: fix bug causing units with max_moves=0...

GitHub noreply at github.com
Tue Sep 6 23:45:55 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: e7bd4bc4efa3c38dee2bab0c6b966b4caf5bc115
      https://github.com/wesnoth/wesnoth/commit/e7bd4bc4efa3c38dee2bab0c6b966b4caf5bc115
  Author: mattsc <mattsc000 at gmail.com>
  Date:   2016-09-06 (Tue, 06 Sep 2016)

  Changed paths:
    M RELEASE_NOTES
    M changelog
    M src/ai/default/attack.cpp

  Log Message:
  -----------
  Default AI: fix bug causing units with max_moves=0 not to attack

The support parameter in the attack evaluation quantifies how much
power the AI can bring to an attack hex. This is supposed to include
the attacking unit itself. However, in some circumstances (such as when
the unit cannot move for one reason or another) this unit is not
accounted for. If no other units can get to this hex either, support is
(erroneously) set to zero, resulting in an attack score of zero, which
in turn results in no attack. Skipping the multiplication of the score
by support in this case does not affect comparison with other attacks
here, as this is by definition the only attack possible on the given
hex.

Note that the '!is_surrounded' conditional is also covered by 'support
!= 0' and can therefore be deleted.

This fixes bug #23720.





More information about the Commits mailing list